Calculate the sequence where each term an is the smallest natural number greater than the previous term, that has exactly n divisors.



Task
Show here, on this page, at least the first 15 terms of the sequence.



See also
 OEIS:A069654


Related tasks
 Sequence: smallest number with exactly n divisors
 Sequence: nth number with exactly n divisors‎‎


#define UPTO 15
 
function divisors(byval n as ulongint) as uinteger
    'find the number of divisors of an integer
    dim as integer r = 2, i
    for i = 2 to n\2
        if n mod i = 0 then r += 1
    next i
    return r
end function
 
dim as ulongint i = 2
dim as integer n, nfound = 1
 
print 1;" ";    'special case
 
while nfound < UPTO
    n = divisors(i)
    if n = nfound + 1 then
        nfound += 1
        print i;" ";
    end if
    i+=1
wend
print
end