Anti-primes: Difference between revisions
Content added Content deleted
(→{{header|Palo Alto Tiny BASIC}}: Added a solution.) |
m (→{{header|Ruby}}: copy-paste error removed) |
||
Line 3,843: | Line 3,843: | ||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
<syntaxhighlight lang="ruby">require 'prime' |
<syntaxhighlight lang="ruby">require 'prime' |
||
{{works with|Halcyon Calc|4.2.7}} |
|||
def num_divisors(n) |
def num_divisors(n) |
||
n.prime_division.inject(1){|prod, (_p,n)| prod *= (n + 1) } |
n.prime_division.inject(1){|prod, (_p,n)| prod *= (n + 1) } |