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


BYTE FUNC CountDivisors(INT a)
  INT i
  BYTE prod,count
 
  prod=1 count=0
  WHILE a MOD 2=0
  DO
    count==+1
    a==/2
  OD
  prod==*(1+count)
 
  i=3
  WHILE i*i<=a
  DO
    count=0
    WHILE a MOD i=0
    DO
      count==+1
      a==/i
    OD
    prod==*(1+count)
    i==+2
  OD
 
  IF a>2 THEN
    prod==*2
  FI
RETURN (prod)
 
PROC Main()
  BYTE toFind=[20],found=[0],count,max=[0]
  INT i=[1]
 
  PrintF("The first %B Anti-primes are:%E",toFind)
  WHILE found<toFind
  DO
    count=CountDivisors(i)
    IF count>max THEN
      max=count
      found==+1
      PrintI(i)
      IF found<toFind THEN
        Print(", ")
      FI
    FI
    i==+1
  OD
RETURN