= Solution
Put $H=(p-1)/2$. Because $p\equiv7\pmod8$, the supplementary laws give
$$
\left(\frac{-1}{p}\right)=-1,
\qquad
\left(\frac2p\right)=1.
$$
Let $R$ and $N$ be the quadratic residues and nonresidues, respectively, among $1,\ldots,H$, and put
$$
S=\sum_{r\in R}r.
$$
Since $-1$ is a nonresidue, the complete set $Q$ of least positive quadratic residues is
$$
Q=R\cup\{p-n:n\in N\}.
$$
If $u=|N|$, its sum is
$$
\sum_{q\in Q}q
=S+up-\sum_{n\in N}n
=2S+up-\frac{H(H+1)}2.
$$
Since $2$ is a residue, multiplication by two permutes $Q$ modulo $p$. Exactly the $u$ upper-half residues $p-n$ cross $p$ when doubled. Equality of the sums before and after reduction therefore gives
$$
\sum_{q\in Q}q
=2\sum_{q\in Q}q-up,
\qquad
\sum_{q\in Q}q=up.
$$
Comparing the two formulas yields
$$
2S=\frac{H(H+1)}2.
$$
As $H=(p-1)/2$,
$$
\boxed{
S=\frac{H(H+1)}4=\frac{p^2-1}{16}.}
$$
This is the <lower-half quadratic-residue sum for primes congruent to seven modulo eight>.
Back to article page