Let be $a_{1},a_{2},a_{3},...,a_{2011},a_{2012}$ integers.Exatly 29 of them divisible by number 3.Show that $a_{1}^2+a_{2}^2+a_{3}^2+...+a_{2011}^2+a_{2012}^2$ is divisible by number 3.

-
If $n$ is not divisible by $3$, then what is $n^2\pmod 3$? – Thomas Andrews Jan 22 '13 at 19:24
$2012-29$ is divisible by $3$. – André Nicolas Jan 22 '13 at 19:33
@AndréNicolas: I found that, too. I think the point is to show that the sum of squares of any 3 numbers, each of which are not divisible by 3, is divisible by 3. – Ron Gordon Jan 22 '13 at 19:35
Observe (this is the remark of Thomas Andrews) that if $a$ is not divisible by $3$, then the remainder when you divide $a^2$ by $3$ is $1$. – André Nicolas Jan 22 '13 at 19:39
@AndréNicolas: of course! QED. – Ron Gordon Jan 22 '13 at 19:50

Hint $\,$ mod prime $p:\ a\not\equiv 0\,\Rightarrow\, a^{p-1}\!\equiv 1,\,$ so $\,a_1^{p-1}\! +\cdots+ a_n^{p-1}\! \equiv\:$the number of $a_i\! \not\equiv 0$