Solution (source code)

= Solution

<Euler's criterion> states, for an <odd prime> $p$,
$$
a^{(p-1)/2}\equiv\left(\frac ap\right)\pmod p.
$$
Apply it to $a=-1$. The <integer> $(-1)^{(p-1)/2}$ is $1$ when $p\equiv1\pmod4$ and $-1$ when $p\equiv3\pmod4$. Since those signs are distinct modulo an <odd prime>, the <modular congruence> determines the actual <Legendre symbol>:
$$
\boxed{\left(\frac{-1}p\right)=\begin{cases}1,&p\equiv1\pmod4,\\-1,&p\equiv3\pmod4.\end{cases}}
$$
This is the <first supplementary law for quadratic reciprocity>.