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‎‎


with javascript_semantics
constant limit = 15
sequence res = repeat(0,limit)
integer next = 1
atom n = 1
while next<=limit do
    integer k = length(factors(n,1))
    if k=next then
        res[k] = n
        next += 1
        if next>4 and is_prime(next) then
            n := power(2,next-1)-1 -- (-1 for +=1 next)
        end if
    end if
    n += 1
end while
printf(1,"The first %d terms are: %v\n",{limit,res})
