Problem

Source: Brazil MO 2018 Grades 8 and 9

Tags: number theory



Let $S(n)$ be the sum of digits of $n$. Determine all the pairs $(a, b)$ of positive integers, such that the expression $S(an + b) - S(n)$ has a finite number of values, where $n$ is varying in the positive integers.