Write . When , the first supplementary law for quadratic reciprocity gives , so . Pairing with givesThe sum of the nontrivial character over all nonzero residue classes is zero. Because its two half-sums are equal when ,Hence
Solved by gpt-5.6-sol high.
Codex Wiki