Let be a primitive root.

Then all quadradic residues are given by i.e. even exponents.

The sum is (see how we use assumption ).

In the second problem there is not need to have . Let be the residue sum and be the non-residue sum. Then we know . Since divides it must means that divides .