Let $S$ be the function that associates to a natural number $n$ the sum of its digits. Find all polynomials with integer coefficients $P$ such that

$$
\forall n \geqslant 2016, P(n)>0 \text { and } S(P(n))=P(S(n))
$$

(IMO SL 2016 N1)
Show by lemma $m \geqslant S(m)$ with equality if and only if $m \in \{0, \ldots, 9\}$. Take $n=10^{k}$ with $k$ large (to "separate the terms" of the polynomial) to observe that $a_{i} \geqslant 0$ for all $i$ (otherwise one can create an arbitrarily long sequence of 9s in $P(n)$ without changing $S(n))$. Then, take $n=9 \cdot 10^{k}$, still with $k$ large, the equality becomes

$$
\sum_{k} a_{k} 9^{k}=P(9)=S\left(P\left(9 \cdot 10^{k}\right)\right)=\sum_{k} S\left(a_{k} 9^{k}\right)
$$

Thus, it is necessary to have $a_{k} 9^{k} \in\{0, \ldots, 9\}$ for all $k$ due to the lemma. By eliminating a few small cases, we arrive at the solution: $P$ is a constant integer between 1 and 9, or $P$ is the identity.