Quadratic Residues
Let be a positive integer and let be an integer such that .
is said to be a quadratic residue modulo if and only if there exists a such that:
When is a prime number there exist three cases:
either is a multiple of , or
is a quadratic residue, or
is not a quadratic residue.
The Legendre symbol captures this as follows.

Legendre Symbol


Jacobi Symbol

Counts
For a prime , the number of integers belonging to the set that are quadratic residues is exactly .
How about composite numbers that are the product of two distinct prime numbers?
Square Roots

Example:
Factorization

Example (continuation of the code of the previous slide):
pari-gp can only compute square roots when the modulus is prime:
Last updated