TITLE: Prove that $(n^3 - 1)n^3(n^3 + 1)$ is divisible by $504$
QUESTION [6 upvotes]: How to prove that $(n^3 - 1)n^3(n^3 + 1)$ is divisible by $504$? Factoring $504$ yields $2^3 \cdot 3^2 \cdot 7$. Divisibility by $8$ can be easily seen, because if $n$ is even then $8 | n^3$, else $(n^3 - 1)$ and $(n^3 + 1)$ are both even and one of these is divisible by $4$ so $8|(n^3 - 1)(n^3 + 1)$. I'm stuck at proving divisibility by $9$ and $7$

REPLY [3 votes]: $(n^3-1)(n^3)(n^3+1) = n^9-n^3$
$n^6 \equiv 1 \pmod 7$  This is Fermat's little theorem. If $p$ prime $n^{p-1}\equiv 1\pmod p$
$n^9-n^3 \equiv n^3-n^3\equiv 0 \pmod 7$
$n^6 \equiv 1 \pmod 9$
If this is not obvious:
$n^2 \equiv 1 \pmod 3\\
n^2 = (3k+1)\\
n^6 = (3k+1)^3 = (27k^3 + 27k^2 + 9k + 1)$
$n^9-n^3 \equiv 0 \pmod 9$