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



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



Related tasks

 Sequence: smallest number greater than previous term with exactly n divisors
 Sequence: nth number with exactly n divisors‎‎


See also

 OEIS:A005179


get "libhdr"
 
manifest $( LENGTH = 15 $) 
 
let divisors(n) = valof
$(  let count = 0 and i = 1
    while i*i <= n
    $(  if n rem i = 0 then
            count := count + (i = n/i -> 1, 2)
        i := i + 1
    $)
    resultis count
$)
 
let sequence(n, seq) be
$(  let found = 0 and i = 1
    for i=1 to n do seq!i := 0
    while found < n
    $(  let divs = divisors(i)
        if divs <= n & seq!divs = 0
        $(  found := found + 1
            seq!divs := i
        $)
        i := i + 1
    $)
$)
 
let start() be
$(  let seq = vec LENGTH
    sequence(LENGTH, seq)
 
    for i=1 to LENGTH do writef("%N ", seq!i)
    wrch('*N')
$)