Anti-primes: Difference between revisions

Content added Content deleted
(add PicoLisp)
Line 1,145: Line 1,145:
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|PicoLisp}}==
<lang PicoLisp>(de factors (N)
(let C 1
(when (>= N 2)
(inc 'C)
(for (I 2 (>= (/ N 2) I) (inc I))
(and (=0 (% N I)) (inc 'C)) ) )
C ) )
(de anti (X)
(let (M 0 I 0 N 0)
(make
(while (> X I)
(inc 'N)
(let R (factors N)
(when (> R M)
(link N)
(setq M R)
(inc 'I) ) ) ) ) ) )
(println (anti 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>


=={{header|Python}}==
=={{header|Python}}==