Anti-primes: Difference between revisions

No edit summary
(→‎{{header|Picat}}: Adding Picat)
Line 2,344:
nl
msec print</lang>
 
=={{header|Picat}}==
{{trans|Go}}
{{works with|Picat}}
<lang Picat>
count_divisors(1) = 1.
 
count_divisors(N) = Count, N >= 2 =>
Count = 2,
foreach (I in 2..N/2)
if (N mod I == 0) then
Count := Count + 1
end
end.
 
main =>
println("The first 20 anti-primes are:"),
MaxDiv = 0,
Count = 0,
N = 1,
while (Count < 20)
D := count_divisors(N),
if (D > MaxDiv) then
printf("%d ", N),
MaxDiv := D,
Count := Count + 1
end,
N := N + 1
end,
nl.
</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|PicoLisp}}==
Line 2,366 ⟶ 2,402:
{{out}}
<pre>(1 2 4 6 12 24 36 48 60 120 180 240 360 720 840 1260 1680 2520 5040 7560)</pre>
 
 
=={{header|PILOT}}==