We substitute k=n+2 such that
S(n)P(n)=(k−2)2+(k−1)2+k2+(k+1)2+(k+2)2=5k2+10=5(k2+2).=(k−2)2(k−1)2k2(k+1)2(k+2)2=k2(k2−1)2(k2−4)2.
As P(n) is the square of the product of 5 consecutive integers, it is divisible by 5. On the other hand, k2+2 is not divisible by 5, because −2 is a quadratic non-residue modulo 5. Therefore, S(n) divides P(n) if and only if k2+2 divides P(n). As k2≡−2(modk2+2),
P(n)≡−2(−2−1)2(−2−4)2≡−23⋅34(modk2+2).
Therefore, the assertion is equivalent to k2+2∣23⋅34. However, k2+2 is congruent to 2 or 3 modulo 4. In particular, 4 does not divide k2+2. We conclude that the assertion is equivalent to k2+2∣2⋅34.
We now consider all positive divisors of 2⋅34:
k2+2k2k1−1020±131±264±497±51816272554528179162160
We conclude that n=k−2∈{−7,−6,−4,−3,−2,−1,0,2,3} are the only solutions. □