Create a function which takes in a input integer and then returns the number of factors it has, like if you pass 25 then it will return 3 since it has 3 factors i.e. 1,5,25. Challenge: Make the fastest and the smallest code!

  • 4
    \$\begingroup\$ "Make the fastest and the smallest code" are incompatible. Since these can be odds, it's unclear how to measure tradeoffs in one versus the other. It's also not clear what "fastest" means without some benchmark. I'd suggest just keeping the shortest code part (code-golf). \$\endgroup\$ – xnor Sep 22 at 7:51
  • \$\begingroup\$ This is known as the divisor function. \$\endgroup\$ – Sisyphus Sep 22 at 7:53
  • 1
    \$\begingroup\$ OEIS A000005 \$\endgroup\$ – xnor Sep 22 at 7:54
  • 6
    \$\begingroup\$ Actually, looks like this is a duplicate of Count the divisors of a number for code golf. \$\endgroup\$ – xnor Sep 22 at 7:56
  • \$\begingroup\$ what's the scoring criterion here? Is it fastest first, then shortest? \$\endgroup\$ – Razetime Sep 22 at 8:00

Neim, 1 byte

𝐜     # Get Divisor count

Try it online!

Got to use Neim, yay.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.