Originally Posted by

**Bacterius** If this is divisible by $\displaystyle 6$, then we have :

$\displaystyle a(a + 1)(2a + 1) \equiv 0 \pmod{6}$

Note that from the definition of the modulus operation, $\displaystyle a \in [0..5]$ (try with $\displaystyle a = 6$, you will get the same result than with $\displaystyle a = 0$). That comes from the fact that $\displaystyle ab \equiv (a \pmod{m})(b \pmod{m}) \pmod{m}$. Thus you can check all values of $\displaystyle a \in [0..5]$ :

$\displaystyle a = 0$, $\displaystyle 0(0 + 1)(2 \times 0 + 1) \equiv 0 \pmod{6}$

$\displaystyle a = 1$, $\displaystyle 1(1 + 1)(2 \times 1 + 1) \equiv 1 \times 2 \times 3 \equiv 6 \equiv 0 \pmod{6}$

Etc ... and you will find out that for $\displaystyle a \in [0..5]$, it works. Thus it works for $\displaystyle a + 6k$, with $\displaystyle k \in \mathbb{Z}$, which matches the set of all integer $\displaystyle a$.

Is it clear enough, or didn't you understand anything ?