A Tau number is a positive integer divisible by the count of its positive divisors.



Task
Show the first   100   Tau numbers.
The numbers shall be generated during run-time (i.e. the code may not contain string literals, sets/arrays of integers, or alike).



Related task
  Tau function


% Count the divisors of [1..N]
count_divisors = proc (n: int) returns (sequence[int])
    divs: array[int] := array[int]$fill(1, n, 1)
    for i: int in int$from_to(2, n) do
        for j: int in int$from_to_by(i, n, i) do
            divs[j] := divs[j] + 1
        end
    end
    return(sequence[int]$a2s(divs))
end count_divisors
 
% Find Tau numbers up to a given limit
tau_numbers = iter (lim: int) yields (int)
    divs: sequence[int] := count_divisors(lim)
    n: int := 0
    while n < lim do
        n := n + 1
        if n // divs[n] = 0 then yield(n) end
    end
end tau_numbers
 
% Show the first 100 Tau numbers
start_up = proc ()
    po: stream := stream$primary_output()
    seen: int := 0
 
    for n: int in tau_numbers(1100) do
        seen := seen + 1
        stream$putright(po, int$unparse(n), 5)
        if seen // 10 = 0 then stream$putl(po, "") end
        if seen >= 100 then break end
    end
end start_up