= Solution
A square residue modulo $p$ is a congruence class represented by $x^2$ for some integer $x$. For the final all-primes solvability statement, zero is included as a square. The <Legendre symbol> distinguishes the zero class from the nonzero square and nonsquare classes:
$$
\boxed{\left(\frac ap\right)=\begin{cases}0,&p\mid a,\\1,&p\nmid a\text{ and }a\equiv x^2\pmod p\text{ for some }x,\\-1,&a\text{ is not a square modulo }p.\end{cases}}
$$
When the term <quadratic residue> is reserved for nonzero classes, the zero case must be stated separately, as in this definition.
Back to article page