Anti-primes: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Added Ruby)
Line 1,080: Line 1,080:
max = 0
max = 0
y << 1 # yield 1
y << 1 # yield 1
2.step(nil,2) do |candidate|
2.step(nil,2) do |candidate| # nil == Infinity
num = num_divisors(candidate)
num = num_divisors(candidate)
if num > max
if num > max
Line 1,095: Line 1,095:
1 2 4 6 12 24 36 48 60 120 180 240 360 720 840 1260 1680 2520 5040 7560
1 2 4 6 12 24 36 48 60 120 180 240 360 720 840 1260 1680 2520 5040 7560
</pre>
</pre>

=={{header|Sidef}}==
=={{header|Sidef}}==
Using the built-in ''Number.sigma0'' method to count the number of divisors.
Using the built-in ''Number.sigma0'' method to count the number of divisors.