Sum of squared quadratic non-residues Can you prove that if $p$ is a prime greater than $5$, then the sum of the squares of the quadratic nonresidues modulo $p$ is divisible by $p$?
Note that I have just proved that the sum of the quadratic residues modulo $p$ is divisible by $p$ for $p$ greater than $3$.
 A: Let $g$ be a primitive root of $p$. Then the non-resuidues are congruent to the odd powers of $g$. Thus their squares are congruent to $g^2$, $g^6$, $g^{10}$, and so on up to $g^{2p-4}$. Add. We get that if $S$ is the sum, then
$$(g^4-1)S \equiv g^2(g^{2(p-1)}-1) \pmod{p}.\tag{1}$$
The right-hand side is congruent to $0$ by Fermat's Theorem. If $p\gt 5$ then $g^4-1\not\equiv 0\pmod{p}$. It follows from (1) that $S\equiv 0\pmod{p}$.
A: Note: For $p=5$, the non-quadratic residues are $2$ and $3$, and $5 \not \mid 2^2 + 3^2 $. So we have $ p \geq 7 $.
There are $\frac{p-1}{2} \geq 3 $ non-residues. Let $a$ be a quadratic non-residue such that $a^2 + 1 \not \equiv 0 \pmod{p}$. This exists because there are at most 2 solutions to the equation, and there are at least 3 values of $a$.
If $R$ is the set of residues, then $aR = \{ ar | r \in R \} $ is the set of non-residues. Let the sum of squares of residues be $s$, and the sum of squares of the non-resiudes are $a^2 s$.
The sum of squares formula is $\sum_{i=1}^p i^2 = \frac{p(p+1)(2p+1)}{6} $.
Hence, $p | (1+a^2) s $. Since $ p \not \mid 1+a^2$, thus $p \mid s$ and $ p \mid a^2 s$.
