Subfield: Number Theory


Question: For any positive integer $k$, denote the sum of digits of $k$ in its decimal representation by $S(k)$. Find all polynomials $P(x)$ with integer coefficients such that for any positive integer $n \geqslant 2016$, the integer $P(n)$ is positive and

$$
S(P(n))=P(S(n))\tag{1}
$$

Solution:
We consider three cases according to the degree of $P$.

- Case 1. $P(x)$ is a constant polynomial.

Let $P(x)=c$ where $c$ is an integer constant. Then (1) becomes $S(c)=c$. This holds if and only if $1 \leqslant c \leqslant 9$.

- Case 2. $\operatorname{deg} P=1$.

We have the following observation. For any positive integers $m, n$, we have

$$
S(m+n) \leqslant S(m)+S(n)\tag{2}
$$

and equality holds if and only if there is no carry in the addition $m+n$.

Let $P(x)=a x+b$ for some integers $a, b$ where $a \neq 0$. As $P(n)$ is positive for large $n$, we must have $a \geqslant 1$. The condition (1) becomes $S(a n+b)=a S(n)+b$ for all $n \geqslant 2016$. Setting $n=2025$ and $n=2020$ respectively, we get

$$
S(2025 a+b)-S(2020 a+b)=(a S(2025)+b)-(a S(2020)+b)=5 a .
$$

On the other hand, (2) implies

$$
S(2025 a+b)=S((2020 a+b)+5 a) \leqslant S(2020 a+b)+S(5 a) .
$$

These give $5 a \leqslant S(5 a)$. As $a \geqslant 1$, this holds only when $a=1$, in which case (1) reduces to $S(n+b)=S(n)+b$ for all $n \geqslant 2016$. Then we find that

$$
S(n+1+b)-S(n+b)=(S(n+1)+b)-(S(n)+b)=S(n+1)-S(n) .\tag{3}
$$

If $b>0$, we choose $n$ such that $n+1+b=10^{k}$ for some sufficiently large $k$. Note that all the digits of $n+b$ are 9's, so that the left-hand side of (3) equals $1-9 k$. As $n$ is a positive integer less than $10^{k}-1$, we have $S(n)<9 k$. Therefore, the right-hand side of (3) is at least $1-(9 k-1)=2-9 k$, which is a contradiction.

The case $b<0$ can be handled similarly by considering $n+1$ to be a large power of 10 . Therefore, we conclude that $P(x)=x$, in which case (1) is trivially satisfied.



- Case 3. $\operatorname{deg} P \geqslant 2$.

Suppose the leading term of $P$ is $a_{d} n^{d}$ where $a_{d} \neq 0$. Clearly, we have $a_{d}>0$. Consider $n=10^{k}-1$ in (1). We get $S(P(n))=P(9 k)$. Note that $P(n)$ grows asymptotically as fast as $n^{d}$, so $S(P(n))$ grows asymptotically as no faster than a constant multiple of $k$. On the other hand, $P(9 k)$ grows asymptotically as fast as $k^{d}$. This shows the two sides of the last equation cannot be equal for sufficiently large $k$ since $d \geqslant 2$.

Therefore, we conclude that $P(x)=c$ where $1 \leqslant c \leqslant 9$ is an integer, or $P(x)=x$.
Let $P(x)=a_{d} x^{d}+a_{d-1} x^{d-1}+\cdots+a_{0}$. Clearly $a_{d}>0$. There exists an integer $m \geqslant 1$ such that $\left|a_{i}\right|<10^{m}$ for all $0 \leqslant i \leqslant d$. Consider $n=9 \times 10^{k}$ for a sufficiently large integer $k$ in (1). If there exists an index $0 \leqslant i \leqslant d-1$ such that $a_{i}<0$, then all digits of $P(n)$ in positions from $10^{i k+m+1}$ to $10^{(i+1) k-1}$ are all 9's. Hence, we have $S(P(n)) \geqslant 9(k-m-1)$. On the other hand, $P(S(n))=P(9)$ is a fixed constant. Therefore, (1) cannot hold for large $k$. This shows $a_{i} \geqslant 0$ for all $0 \leqslant i \leqslant d-1$.

Hence, $P(n)$ is an integer formed by the nonnegative integers $a_{d} \times 9^{d}, a_{d-1} \times 9^{d-1}, \ldots, a_{0}$ by inserting some zeros in between. This yields

$$
S(P(n))=S\left(a_{d} \times 9^{d}\right)+S\left(a_{d-1} \times 9^{d-1}\right)+\cdots+S\left(a_{0}\right) .
$$

Combining with (1), we have

$$
S\left(a_{d} \times 9^{d}\right)+S\left(a_{d-1} \times 9^{d-1}\right)+\cdots+S\left(a_{0}\right)=P(9)=a_{d} \times 9^{d}+a_{d-1} \times 9^{d-1}+\cdots+a_{0} .
$$

As $S(m) \leqslant m$ for any positive integer $m$, with equality when $1 \leqslant m \leqslant 9$, this forces each $a_{i} \times 9^{i}$ to be a positive integer between 1 and 9 . In particular, this shows $a_{i}=0$ for $i \geqslant 2$ and hence $d \leqslant 1$. Also, we have $a_{1} \leqslant 1$ and $a_{0} \leqslant 9$. If $a_{1}=1$ and $1 \leqslant a_{0} \leqslant 9$, we take $n=10^{k}+\left(10-a_{0}\right)$ for sufficiently large $k$ in (1). This yields a contradiction since

$$
S(P(n))=S\left(10^{k}+10\right)=2 \neq 11=P\left(11-a_{0}\right)=P(S(n)) .
$$

The zero polynomial is also rejected since $P(n)$ is positive for large $n$. The remaining candidates are $P(x)=x$ or $P(x)=a_{0}$ where $1 \leqslant a_{0} \leqslant 9$, all of which satisfy (1), and hence are the only solutions.

Final answer: - $P(x)=c$ where $1 \leqslant c \leqslant 9$ is an integer; or
- $P(x)=x$