$R$ is a UFD. Let $P(x) \in R[x]$.
If $n \in \mathbb{N}$, define $P^n(x)= P(P(\cdots(P(x))\cdots))$, where we iterate $P(x)$ $n$ times.
Prove that if $d|n$, then $P^d(x)-x$ divides $P^n(x)-x$.
I feel like I don't know how I should approach this problem. Maybe I should take it up to the field of fractions and use Gauss' Lemma, but I am stuck before I started.
Sorry if this is a duplicate. In my experience, it has been hard searching for Abstract Algebra problems because it is so notation heavy.
Here's a slick proof : look at $R[x]/(P^d(x)-x)$.
Then in this ring you have $P^d(x) =x$. Apply $P$ to that equality $d$ times and get $P^{2d}(x) = P^d(x) = x$.
Iterate again to get (by induction) $P^{kd}(x) = x$, in particular for $kd=n$ you get $P^n(x)=x$ in that ring, so $P^d(x)-x \mid P^n(x)-x$