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


print "The first 20 anti-primes are:"
 
while (count < 20)
    n = n + 1
    d = count_divisors(n)
    if d > max_divisors then
        print n;
        max_divisors = d
        count = count + 1
    end if
wend
print
 
sub count_divisors(n)
    local count, i
 
    if n < 2 return 1
 
    count = 2
    for i = 2 to n/2
      if not(mod(n,  i)) count = count + 1
    next
    return count
end sub