Jump to content

Anti-primes: Difference between revisions

Added Sidef
m (→‎{{header|Perl 6}}: Reduce some redundant calculations)
(Added Sidef)
Line 130:
{{out}}
<pre>[1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560]</pre>
 
=={{header|Sidef}}==
Using the built-in ''Number.sigma0'' method to count the number of divisors.
<lang ruby>say with (0) {|max|
1..Inf -> lazy.grep { (.sigma0 > max) && (max = .sigma0) }.first(20)
}</lang>
{{out}}
<pre>
[1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560]
</pre>
2,747

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.