For which n is 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n true?

• Jun 5th 2013, 07:56 AM
xaosman
For which n is 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n true?
For which n ≥ 2 is the following true; 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n

I've tried some numbers and found that it works for 5 but I'm not exactly sure why that is.

I'm aware of that 1^2 + 2^2 + ... + (n-1)^2 is the sum of every element in complete residue system for n multiplicative by itself and that I need to find out when there's a factor n in this sum but I'm honestly pretty stuck. Can anyone perhaps help me out?
• Jun 5th 2013, 08:14 AM
Prove It
Re: For which n is 1^2 + 2^2 + ... + (n-1)^2 ≡ 0 mod n true?
It might help to use the well known sum \displaystyle \begin{align*} \sum_{k = 1}^{n} k^2 = \frac{n(n + 1)(2n+1)}{6} \end{align*}, or equivalently \displaystyle \begin{align*} \sum_{k = 1}^{n - 1}k^2 = \frac{(n - 1)(n)(2n - 1)}{6} \end{align*}.

http://i22.photobucket.com/albums/b3...ofintegers.jpg

http://i22.photobucket.com/albums/b3...mofsquares.jpg