Anti-primes: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 1,050:
{{out}}
<pre>[1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560]</pre>
=={{header|Nanoquery}}==
{{trans|C}}
<lang nanoquery>def countDivisors(n)
if (n < 2)
return 1
end
count = 2
for i in range(2, int(n/2))
if (n % i) = 0
count += 1
end
end
return count
end
maxDiv = 0
count = 0
println "The first 20 anti-primes are:"
for (n = 1) (count < 20) (n += 1)
d = countDivisors(n)
if d > maxDiv
print format("%d ", n)
maxDiv = d
count += 1
end
end
println</lang>
{{out}}
<pre>The first 20 anti-primes are:
1 2 4 6 12 24 36 48 60 120 180 240 360 720 840 1260 1680 2520 5040 7560 </pre>
=={{header|Nim}}==
|