Let p be an odd prime. Prove that every primitive root of p is a quadratic nonresidue. Prove that every quadratic nonresidue is a primitive root if and only if is of the form where is a non-negative integer, that is, if and only if is a Fermat number.

I have no clue what to do.