31-4 Quadratic residues
Let be an odd prime. A number is a quadratic residue if the equation has a solution for the unknown .
a. Show that there are exactly quadratic residues, modulo .
b. If is prime, we define the Legendre symbol , for , to be if is a quadratic residue modulo and otherwise. Prove that if , then
Give an efficient algorithm that determines whether a given number is a quadratic residue modulo . Analyze the efficiency of your algorithm.
c. Prove that if is a prime of the form and is a quadratic residue in , then is a square root of , modulo . How much time is required to find the square root of a quadratic residue modulo ?
d. Describe an efficient randomized algorithm for finding a nonquadratic residue, modulo an arbitrary prime , that is, a member of that is not a quadratic residue. How many arithmetic operations does your algorithm require on average?
(Omit!)