When does $x^2+2y^2 =p$ have a solution in integers?
One direction: if $x^2+2y^2=p$ then $x^2\equiv -2y^2\pmod{p}$. But $\gcd(y,p)=1$ so $(x/y)^2\equiv -2\pmod{p}$. Hence $1=\left(\frac{-2}{p}\right)=\left(\frac{2}{p}\right)\left(\frac{-1}{p}\right)=(-1)^{\frac{(p+1)(p-1)}{8}}(-1)^{\frac{p-1}{2}}$ which implies $p\equiv 1,3\pmod{8}$.