5. Given the polynomial $p(x)=x(x+1)(x-2)^{2}$, consider the polynomial $q(x)=p(p(p(\ldots(p(x)) \ldots)))$ given by the composition of $p(x)$ with itself 2024 times. How many integers $k$ are there such that $q(k)=0 ?$
(A) 1
(B) 3
(C) 4
(D) 5
(E) 6
5. The answer is $\mathbf{( C )}$. Let $q_{k}(x)=p(p(\ldots(p(x))))$ be the polynomial obtained by composing the polynomial $p$ with itself $k$ times, so that $q(x)=q_{2024}(x)$. It is clear that $q_{k}(x)$ is a polynomial with integer coefficients. Since for $k>1$ we have $q_{k}(x)=p\left(q_{k-1}(x)\right)$ and since the only solutions to the equation $p(x)=0$ are given by $x=0, x=-1$ and $x=2$, it follows that $q_{k}(x)=0$ if and only if $q_{k-1}(x) \in\{0,-1,2\}$. Note that the equation $p(x)=-1$ has no integer solutions, while $p(x)=0$ (resp. $p(x)=2$) has the unique solution $x=0$ (resp. $x=1$); therefore, for $k \geq 2$ we have $q_{k-1}(x)=p\left(q_{k-2}(x)\right) \in\{0,1,2\}$ if and only if $q_{k-2}(x) \in\{0,1\}$. Finally, since $p(x)=1$ has no integer solutions, for $k>3$ the equation $q_{k-2}(x)=p\left(q_{k-3}(x)\right)=1$ has no solutions and thus $q_{k-1}(x)=p\left(q_{k-2}(x)\right) \in\{0,1,2\}$ if and only if $q_{k-2}(x)=0$.

Summarizing the above, for $k>3$, we have that $q_{k}(x)=0$ is satisfied if and only if $q_{k-2}(x)=0$. Chaining this implication enough times, we obtain that $q(x)=q_{2024}(x)=0$ if and only if $q_{2}(x)=p(p(x))=0$, which is easily seen to have the solutions $x \in\{-1,0,1,2\}$.