Property of quadratic residues A simple question. If $p$ is an odd prime - just to avoid trivial cases, assume $p>3$ - and  $z\in\mathbb{N}$. What can we say about $\left(p-z\mid p\right)$, where the notation $\left(a\mid b\right)$ denotes the Legendre symbol of $a$ and $b$?
Thanks
 A: Well, we can say it is $(-z\mid p)$. And we can add that it is $(z\mid p)$ if $p\equiv  1\pmod{4}$, and $-(z\mid p)$ if $p\equiv 3\pmod{4}$.  
A: Note that since $x^{p-1}=1$ for all $x\not\equiv0\pmod{p}$, we have 
$$
\left(x^{\frac{p-1}2}\right)^2\equiv1\pmod{p}\tag{1}
$$
Since there are at most $\frac{p-1}2$ roots of
$$
x^{\frac{p-1}2}\equiv1\pmod{p}\tag{2}
$$
and at most $\frac{p-1}2$ roots of
$$
x^{\frac{p-1}2}\equiv-1\pmod{p}\tag{3}
$$
and there are exactly $p-1$ roots of $(1)$ there must be exactly $\frac{p-1}2$ roots of each $(2)$ and $(3)$. Since $x^2\equiv y^2\pmod{p}$ is true if and only if $x\equiv y\pmod{p}$ or $x\equiv-y\pmod{p}$, and $p$ is odd, exactly half of the non-zero residue classes mod $p$ are quadratic residues. Furthermore, if $x=y^2$, then
$$
x^{\frac{p-1}2}=y^{p-1}\equiv1\pmod{p}\tag{4}
$$
Therefore, $\left(x\over p\right)=1\implies(2)$ and $\left(x\over p\right)=-1\implies(3)$; that is,
$$
\left(x\over p\right)\equiv x^{\frac{p-1}2}\pmod{p}\tag{5}
$$

Therefore, using $(5)$, we can say
$$
\begin{align}
\left(p-x\over p\right)
&=\left(-x\over p\right)\\
&=\left(-1\over p\right)\left(x\over p\right)\\
&=\left\{\begin{array}{rl}
\left(x\over p\right)&\text{if }p\equiv1\pmod{4}\\
-\left(x\over p\right)&\text{if }p\equiv3\pmod{4}
\end{array}\right.\tag{6}
\end{align}
$$
