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




import Foundation
 
func digitSum(_ num: Int) -> Int {
    var sum = 0
    var n = num
    while n > 0 {
        sum += n % 10
        n /= 10
    }
    return sum
}
 
for n in 1...70 {
    for m in 1... {
        if digitSum(m * n) == n {
            print(String(format: "%8d", m), terminator: n % 10 == 0 ? "\n" : " ")
            break
        }
    }
}