To Show that $6$ divides $n$ if $6$ $|$ $(p_1 ^2 + p_2 ^2 + p_3 ^2 ......... p_n ^2)$ where $p_i$ is a prime$ Let $n$ be a positive integer and there be $p_1,p_2,p_3,........p_n$ prime numbers such that all of them are greater than $5$. If $6$ divides $p_1 ^2 + p_2 ^2 + p_3 ^2+\ldots +p_n ^2$, prove that $6$ divides $n$.
NOTE:- This problem is the $2nd$ question of $1998$ $RMO$ (Regional Mathematical Olympiad).
I tried using congruences with $2$ and $3$ on the first condition but it does not work.
 A: Notice that every prime$>3$ is of the form $6n\pm1$, So square of every such prime will be $36n^2\pm12n+1$, so when you are adding all those squares, you will get something like: 
$36(n_1^2+n_2^2+n_3^2......)+12(\pm n_1+\pm n_2.....)+ n(1)$..
The two terms containing $6$ and $12$ are divisible by $6$, the divisibility of whole by $6$ depends upon divisibilty of $n$ by $6$ and vice versa.
A: The sum of squares of $n$ odd numbers is $\equiv n\pmod 8$ because a single odd square is $\equiv 1\pmod 8$; similarly the sum of squares of $n$ numbers not divisible by $3$ is $\equiv n\pmod 3$. Hence under the given conditions, we even have $p_1^2+\ldots +p_n^2\equiv n\pmod {24}$, but of course in particular $p_1^2+\ldots +p_n^2\equiv n\pmod {6}$.
A: Using congruences on $2$ and $3$ works as follows:
For all primes $p_i\ge 5$, we know that $2 \nmid p_i$ and $3\nmid p_i$. Therefore $p_i^2\equiv 1 \bmod 2$ and $p_i^2\equiv 1 \bmod 3$, which immediately gives us that $p_i^2 \equiv 1 \bmod 6$ by the Chinese Remainder Theorem.
Clearly adding $n$ such prime squares to a total $s$ will only give us $s\equiv 0\bmod 6 $ (that is, $s\mid 6$) if $n\mid 6 $ also.
