Problem

Source: 2022 Thailand MO Day 2 P10

Tags: number theory



For each positive integers $u$ and $n$, say that $u$ is a friend of $n$ if and only if there exists a positive integer $N$ that is a multiple of $n$ and the sum of digits of $N$ (in base 10) is equal to $u$. Determine all positive integers $n$ that only finitely many positive integers are not a friend of $n$.