Proving $9$ divides $n^3 + (n+1)^3 + (n+2)^3$ [duplicate]

HINT:

Induction:

Let $f(n)=n^3+(n+1)^3+(n+2)^3$

$f(m+1)-f(m)=(m+3)^3-m^3=9(m^2+3m+3)$

So, $f(m+1)$ will be divisible by $9\iff f(m)$ is.

Check for the base case


$$(n-1)^3+n^3+(n+1)^3=3n^3+6n=3(n^3-n)+9n$$

Now $n^3-n=(n-1)n(n+1)$ is product of three consecutive integers, hence divisible by $3!$

Also, $$(n+1)^3+(n+2)^3+(n+3)^3=3n^3+18n^2+42n+36\equiv3(n^3-n)\pmod9$$