Mathworld says that $-2$ is a quadratic residue modulo a prime $p$ if and only if $p=8n+1$ or $p=8n+3$, though I don't understand their explanation.
I have seen elementary proofs that $-1$ is a quadratic residue if and only if $p=8n+1$, and $2$ is a quadratic residue if and only if $p = 8n+1$ or $p=8n-1$, but I cannot find (or come up with) a proof for 2. Is there some way to combine the results of $-1$ and $2$, or is there a completely separate way?
Much appreciation, thanks.