The anti-primes
(or highly composite numbers, sequence A002182 in the OEIS)
are the natural numbers with more factors than any smaller than itself.



Task

Generate and show here, the first twenty anti-primes.



Related tasks

   Factors of an integer
   Sieve of Eratosthenes


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