For a prime number $p > 2$ the following formula for the Legendre symbol holds:
$$\left(\frac {2}p\right)=(-1)^{\frac{p^2-1}{8}}.$$
More in detail, this law states that $$\left(\frac {2}p\right)=\begin{cases}1&\text{if }p\equiv \pm 1\mod 8,\\-1&\text{if }p\equiv \pm 3\mod 8.\end{cases}$$
In particular, the congruence $x^2(p)\equiv 2(p)$ is only solvable, if $p$ has the form $p\equiv \pm 1\mod 8,$ and any odd prime factor of the integer $x^2-2$ has the form $p\equiv \pm 1\mod 8.$
Proofs: 1
Proofs: 1