func d(_ n: Int) -> Int {
let digits = String(n).map { Int(String($0))! }
return n + digits.reduce(0, +)
}
var check = Array(repeating: false, count: 10001)
for n in 1..<10001 {
let d = d(n)
if d < 10001 {
check[d] = true
}
}
for i in (1..<check.count) {
if !check[i] { print(i) }
}