By Euler criterion,
Choose a primitive root . For any integer not divisible by ,
For , the exponent satisfies . Therefore
Together with part (i), this is the weighted complete Legendre-symbol sum.