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


 
Dim Results(20)
Candidate = 1
max_divisors = 0
 
Print "Los primeros 20 anti-primos son:"
For j = 0 To 19
	Do
		divisors = count_divisors(Candidate)
		If max_divisors < divisors Then
			Results[j] = Candidate
			max_divisors = divisors
			Exit Do
		End If
		Candidate += 1
	Until false
	Print Results[j];" ";
Next j
 
Function count_divisors(n)
	cont = 1
	For i = 1 To n/2
		If (n % i) = 0 Then cont += 1
	Next i
	count_divisors = cont
End Function
 