# How to show $n(n+1)(2n+1) \equiv 0 \pmod 6$?

I've been asked to show that:

$n(n+1)(2n+1) \equiv 0 \pmod 6$

I found in a previous question that:

$n(n+1)$ was divisible by $2$ and resulted in an even number e.g

$n(n+1) \equiv 0 \pmod 2$

so I figured I needed to find:

$(2n+1) \equiv 0 \pmod 3$ in order to complete

$n(n+1)(2n+1) \equiv 0 \pmod 6$

but I am unsure on how to find $(2n+1) \equiv 0 \pmod 3$

Is this the right way to find the mod 6 and if so could you tell me how I could find

$(2n+1) \equiv 0 \pmod 3?$

-

A rather unconventional way to solve this is by using the identity $$\sum^n_{k=0}k^2=\frac{n(n+1)(2n+1)}{6}$$ Since $\dfrac{n(n+1)(2n+1)}{6}$ is a sum of integers, it must be an integer as well. Therefore $n(n+1)(2n+1)$ is divisible by $6$.

-
It's not unconventional but natural if one knows telescopy - see my answer. –  Bill Dubuque Jul 27 '14 at 4:15
If needed, here is link to a post about the sum of squares formula used in your post: math.stackexchange.com/questions/48080/… –  Martin Sleziak Nov 23 '14 at 11:08

${\rm mod}\ 6\!:\ f(n) = n(n\!+\!1)(2n\!+\!1)\,$ is constant by $\,f(n)-f(n\!-\!1) = 6n^2\equiv 0,\,$ so $\,f(n)\equiv f(0)\equiv 0$.

Remark $\$ Summing the above difference, using telescopy, we obtain $\,f(n) = 6\sum_{k=1}^n k^2\equiv 0$

-

The numbers $2n$, $2n+1$, and $2n+2$ are three consecutive numbers, so one of them is divisible by $3$. If $2n+1$ is not, then one of $2n$ or $2n+2$ is. But if $2n$ is divisible by $3$, so is $n$. And if $2n+2$ is divisible by $3$, so is $n+1$. Thus one of $n$, $2n+1$, and $n+1$ is divisible by $3$.

-

$$n(n+1)(2n+1)=n(n+1)(2n-2+3)=2\underbrace{(n-1)n(n+1)}_{3\text{ consecutive integers}}+3\underbrace{n(n+1)}_{2\text{ consecutive integers}}$$

Reference :

-

It is not necessary to have $\displaystyle 2n+1\equiv0\pmod3\iff2n\equiv-1\equiv2$

$\displaystyle\iff n\equiv1\pmod3$ as $(2,3)=1$

As for $\displaystyle n\not\equiv1,n\equiv0$ or $-1\pmod3$

In either case, $\displaystyle3|n(n+1)\implies 3|n(n+1)(2n+1)$

Alternatively, for any integer $\displaystyle n, n\equiv-1,0$ or $1\pmod3$

For the first two cases, $\displaystyle3|n(n+1)\implies 3|n(n+1)(2n+1)$

If $n\equiv1\pmod3,2n+1\equiv0$

-