Anti-primes: Difference between revisions

(add gw basic)
Line 789:
</pre>
 
=={{header|Forth}}==
This task uses [http://rosettacode.org/wiki/Factors_of_an_integer#Alternative_version_with_vectored_execution]
<lang Forth>
include ./factors.fs
 
: max-count ( n1 n2 -- n f )
\ n is max(n1, factor-count n2); if n is new maximum then f = true.
\
count-factors 2dup <
if nip true
else drop false
then ;
 
: .anti-primes ( n -- )
0 1 rot \ stack: max, candidate, count
begin
>r dup >r max-count
if r> dup . r> 1-
else r> r>
then swap 1+ swap
dup 0= until drop 2drop ;
 
." The first 20 anti-primes are: " 20 .anti-primes cr
bye
</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|Fortran}}==
{{trans|C}}
357

edits