Anti-primes: Difference between revisions
Content deleted Content added
Add Swift |
No edit summary |
||
Line 1,257: | Line 1,257: | ||
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} |
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> |
</pre> |
||
=={{header|Phixmonti}}== |
|||
<lang Phixmonti>0 var count |
|||
0 var n |
|||
0 var max_divisors |
|||
"The first 20 anti-primes are:" print nl |
|||
def count_divisors |
|||
dup 2 < if |
|||
drop |
|||
1 |
|||
else |
|||
2 |
|||
swap 1 over 2 / 2 tolist |
|||
for |
|||
over swap mod not if swap 1 + swap endif |
|||
endfor |
|||
drop |
|||
endif |
|||
enddef |
|||
true |
|||
while |
|||
count 20 < dup if |
|||
n 1 + var n |
|||
n count_divisors |
|||
dup max_divisors > if |
|||
n print " " print |
|||
var max_divisors |
|||
count 1 + var count |
|||
else |
|||
drop |
|||
endif |
|||
endif |
|||
endwhile |
|||
nl |
|||
msec print</lang> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |