# Induction: Prove that if $p$ is a prime number, then the sum of squares is divisible by $p$

Use the Theorem $$1^2+2^2+....+n^2 = \frac{n(n+1)(2n+1)}{6}$$ to prove that if $p$ is any prime number with $p \geq 5$, then the sum of squares of any $p$ consecutive integers is divisible by $p$.

I'm confused with how to go about doing this, I have the solution to the problem, but I'm unsure what exactly is happening.

In the first part of the solution it says:

for $n=1$ and $p \geq 5$,

$$1^2+2^2+...(1+p-1) = \frac{p(p+1)(2p+1)}{6}$$

I understand how we got the right side of the equation, but I'm unsure about the left side. How do we get $1+p-1$ as the last term?

From here can anyone explain the rest of the proof?

• Did you mean $(1 + p - 1)^2$? Please read this tutorial on how to typeset mathematics on this site. Nov 12, 2015 at 10:46

Any $p$ consecutive integers are congruent modulo $p$, in some order, to $1,2,3,\dots,p$.
So the sum $S$ of their squares is congruent, modulo $p$, to $1^2+2^2+\cdots+p^2$. By a standard formula, this sum is $\frac{p(p+1)(2p+1)}{6}$. Thus
$$6S\equiv p(p+1)(2p+1)\equiv 0\pmod{p}.$$ It follows that $p$ divides $6S$. But $p\ge 5$, so $p$ does not divide $6$. It follows that $p$ divides $S$.