Let n=degP(x)≥1 and a=0 be the leading coefficient of P, then comparing the leading coefficients of both sides to get a=±1. Note that if P(x) satisfies then so does −P(x); without loss of generality, we assume that a=1.
First, let solve the problem when n=1, consider P(x)=x+b. Substituting into the given condition,
x3−7x+b=(x−7+b)(x−8+b)(x−3+b).
Comparing the coefficient of degree 2, we have 0=b−7+b−8+b−3 so b=6. Therefore, P(x)=x+6, which is a solution.
Now, for any n≥1, let P(x)=(x+6)n+Q(x) with degQ<n. If Q(x)≡0 then we have P(x)=(x+6)n, which satisfies since
(x3−7x+6)n=(x−1)n(x−2)n(x+3)n.
Now assume that Q(x)=0 and put degQ=m<n. Substituting in the given condition then we get
(x3−7x+6)n+Q(x3−7x)=[(x−1)n+Q(x−7)][(x−2)n+Q(x−8)][(x+3)n+Q(x−3)]
Then expanding and simplifying, we get
Q(x3−7x)=Q(x−7)Q(x−8)Q(x−3)+(x−1)nQ(x−8)Q(x−3)+(x−2)nQ(x−7)Q(x−3)+(x+3)nQ(x−7)Q(x−8)+(x−1)n(x−2)nQ(x−3)+(x−2)n(x+3)nQ(x−7)+(x+3)n(x−1)nQ(x−8).
Comparing the degree of both sides, 3m=2n+m or m=n, a contradiction.
From these arguments, one can conclude that all solutions of the given condition are P(x)=±(x+6)n for all positive integers n. □