Generate the sequence a(n) when each element is the minimum integer multiple m such that the digit sum of n times m is equal to n.



Task
 Find the first 40 elements of the sequence.


Stretch
 Find the next 30 elements of the sequence.


See also
 OEIS:A131382 - Minimal number m such that Sum_digits(n*m)=n




digit_sum = proc (n: int) returns (int)
    sum: int := 0
    while n > 0 do
        sum := sum + n // 10
        n := n / 10
    end
    return(sum)
end digit_sum
 
a131382 = iter () yields (int)
    n: int := 1
    while true do
        m: int := 1
        while digit_sum(m * n) ~= n do
            m := m + 1
        end
        yield(m)
        n := n + 1
    end
end a131382
 
start_up = proc ()
    po: stream := stream$primary_output()
    n: int := 0
 
    for m: int in a131382() do
        stream$putright(po, int$unparse(m), 9)
        n := n + 1
        if n = 70 then break end
        if n // 10 = 0 then stream$putl(po, "") end
    end
end start_up