Prove that $(n^3 - 1)n^3(n^3 + 1)$ is divisible by $504$ 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$
 A: $(n^3 - 1)n^3(n^3 + 1) =n^3(n^6 -1)$
Since $\phi(7)=\phi(9)=6$, we get that $7$ and $9$ always divide $n^3(n^6 -1)$, by Euler–Fermat.
A: For $7$: $(n^3-1)(n^3+1)=n^6-1$ then apply Fermat's little theorem.
For $3^2$ : First, $(k-1)k(k+1)$ has to be divisible by $3$.
Second, $(n^3-1)\cdot(n^3+1)=(n-1)(n^2+n+1)\cdot (n+1)(n^2-n+1)$ which has the factor $(n^2-1)$ which is divisible by 3 by Fermat's LT.
A: For 9: if $n$ is divisible by 3, then the conclusion is obvious. If $n \equiv 1 \bmod 3$, then $n^3 \equiv 1 \bmod 9$ (proof: write $n^3 = (3k+1)^3 = 27k^3 + 27k^2 + 9k + 1$; all terms but the constant are killed modulo 9). If $n \equiv -1 \bmod 3$, then $n^3 \equiv -1 \bmod 9$ (proof is similar).
For 7, the conclusion follows from arberavdullahu's comment about cubic residues. If you'd rather it be more explicit: let $m \in \{0, \ldots, 6\}$ be such that $m \equiv n \bmod 7$; then $n^3 = (7k+m)^3 = 343k^3 + 147 k^2 m + 21km^2 + m^3$; all terms but $m^3$ die modulo 7, so you just have to check that all of $0^3, \ldots, 6^3$ are congruent to one of $-1, 0, 1$. In general, though, $n^p \equiv m^p \mod r$ as long as $n \equiv m \mod r$, so this step is easy (the mod-9 step, where we had to move from mod-3 considerations to mod-9, was a bit harder).
A: $(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$
A: Hints


*

*For $7$, what are the possible values of $n^3 \pmod 7$? (It suffices to check $-3, \ldots 3$.)

*For $9$, what are the values of $n^3 - 1, n^3, n^3 + 1 \pmod 9$? For example, for $n = 4 \pmod 9$ we have $n^3 - 1 = 0 \pmod 9$, so the given product is also divisible by $9$.

A: Hint -
We have 504 =$(2^3-1)2^3(2^3+1)$
