# The sum of the cubes of three consecutive integers is divisible by $9$

The question is in the title and my try comes here:

Let $n\in\mathbb{Z}$, then we have to look at $$(n-1)^3+n^3+(n+1)^3=3n(n^2+2)$$ so if we can show that $n(n^2+2)$ is divisible by $3$ we are done. So I divide it up into three cases

1. $n\equiv 0 \ (\mathrm{mod} \ 3)$ means we are done.

2. $n\equiv 1 \ (\mathrm{mod} \ 3)$, then $n^2\equiv 1 \ (\mathrm{mod} \ 3)$ and then $3\mid(n^2+2)$ and we are done.

3. $n\equiv 2 \ (\mathrm{mod} \ 3)$, then $n^2\equiv 1 \ (\mathrm{mod} \ 3)$ and then again $3\mid(n^2+2)$ and in this case too we get the desired result.

First of all, is this correct? And secondly if it is correct, is there a more elegant way of showing this result?

Thank you!

You can observe that $$n(n^2+2)\equiv n(n^2+3n+2)\equiv n(n+1)(n+2) \bmod 3$$ and that the product of three successive integers is divisible by $3$

• really nice! thank you – Vinyl_cape_jawa Oct 25 '17 at 9:20

The classes mod $9$ of the cubes of $0, \ldots, 8$ are $$0, \, 1, \, -1, \, 0, \, 1, \, -1, \, 0, \, 1, \, -1.$$ The sum of any three consecutive of them is clearly $0$.

Yes, your way is correct. An alternative method (which I leave you to determine whether it is more elegant or not):

$$(n+1)^3 +n^3 +(n-1)^3 = 3n(n^2+2) = 3n(n^2-1+3)\\=3n((n-1)(n+1)+3)=3(n-1)n(n+1)+9n$$

Of the consecutive numbers $(n-1), n, (n+1)$ one is divisible by $3$, which leaves that the term is divisible by 9.

Either $n$ is divisible by $3$ or it is not.

If it is, then $n(n^2+2)$ is clearly divisible by $3$.

If it is not, then it must be co-prime with $3$ (since $3$ is prime), then by Fermat's little theorem we have $n^2 \equiv 1 \pmod 3$, whence $n^2+2 \equiv 0 \pmod 3$, so $n^2+2$ is divisible by $3$, and so is $n(n^2+2)$.