Find all polynomials $P(x)=a_0+a_1x+... a_nx^n; a_i \in Z$ such that $\forall x$:
$P(x)=(x-P(0))(x-P(1))...(x-P(n-1))$
I substituted some values like $0,1$ to get an idea of the polynomial coefficients and tried to see some pattern but it doesn't seem to be helping much. Also is it possible that calculus might play a role here since we have been given a polynomial function and not just a functional equation in general?
First of all, notice that the leading term of the RHS is always $1$. So we get $a_n = 1$ to begin with. Secondly, setting $x=0$ gives: \begin{align*} P(0) &= \prod_{i=0}^{n-1}-P(i)\\ &= (-1)^n \prod_{i=0}^{n-1}P(i)\\ &= P(0)(-1)^n \prod_{i=1}^{n-1}P(i) \end{align*}
Now, he have two cases, depending on whether $P(0) = 0$ or not.
Assume that $P(0) \neq 0$ $$1 = (-1)^n \prod_{i=1}^{n-1}P(i)$$ But given that $a_i \in Z$ it follows that $P(i) \in Z$ so $P(i) = \pm 1$ for $i > 0$. So, we derive the following equation:
$$ P(x)=(x-a_0)(x+1)^k(x-1)^{n-1-k} $$ with $n-1-k$ odd. So $P(1) = 0$ which is a contradiction if the degree of $P$ is larger than $1$ and we should check if $n=1$ by hand. $$ P(x) = x - P(0) \implies x + a_0 = x - a_0 \implies a_0 = 0$$ Contradiction.
So $P(0) = 0$. Let $P(x) = xQ(x)$. Then,if $Q$ is not a constant polynomial, $$ Q(x) = (x - Q(1))(x-2Q(2))...(x-(n-1)Q(n-1)) $$ Again, the leading coefficient is equal to $1$. Setting $x=m \in \{1,...,n-1\}$ gives $$Q(m) = (m-mQ(m))c_m = -mc_m(Q(m)-1) \implies \\ \frac{Q(m)}{Q(m)-1} = -mc_m \in Z $$ The RHS can only be an integer when $Q(m) = 0$ or $Q(m) = 2$. It's easy to see that the first can't be true. Now, if $Q(m) = 2$ then $Q(2) = 0$ which is a contradiction unless $Q$ is of degree $1$. $$ Q(x) = x - Q(1) \implies x + c = x - (1+c) \implies c = -1/2$$ which is a contradiction as it would lead to non integers $a_i$ in $P(x)$.
And we are done, because no solutions for $Q(x)$ implies that $Q$ is constant which tells that the only solution is $P(x) = x$.
EDIT: Actually, the $Q(m) = 0$ or $2$ part has a problem. It could be one or the other and I only showed that it can't be constantly one or the other. To bypass that simply notice that $Q(1)$ can't be $0$ when $Q(2) = 2$.