Solution:
We have P1(x)=P2(x)=1, P3(x)=x+1, P4(x)=x2+1 and P6(x)=x4+1. Hence the integers n=1,2,3,4,6 have the desired property. We shall prove that these are the only solutions of the problem.
It is enough to show that for n≥3 the polynomial Pn(x) has a divisor of the form 1+xr, r≥1, which is a proper divisor for n=5 and n≥7.
If n≥3 is a prime, this follows by the decomposition
Pn(x)=(1+x)(1+x2+x4+⋯+xn−3)
Note also that P4(x)=x2+1.
Now we shall use induction on n. Suppose that the statement is true for all m≥3 that are less than n. If n≥6 is a composite integer, then n=mp, where p is prime and m≥3. Two cases are possible.
Case 1. p divides m. Then we have that An=∪i=0p−1(Am+im) and hence Pn(x)=Pm(x)∑i=0p−1xim. It remains to use that Pm(x) has a divisor of the form 1+xr.
Case 2. p does not divide m. Using that
An=(∪i=0p−1(Am+im))∖(pAm)
and xkp−1=xp−1(xp)k−1, it follows that
Pn(x)=Pm(x)i=0∑p−1xim−xp−1Pm(xp)
By the induction assumption, Pm(x) has a divisor of the form 1+xr. Therefore 1+xpr divides Pm(xp). We shall consider two subcases.
a) If p≥3, then p is odd and 1+xr divides 1+xpr. Hence 1+xr divides Pn(x).
b) If p=2, we may assume that m is prime (otherwise, m has an odd prime divisor and we may go either to a) or to the first case). Then
Pn(x)=(1+xm+1)(1+x2+x4+⋯+xm−3)
It remains to observe that Pn(x)=1+xr only for n=3,4,6 which completes the solution.