Suppose that $ p$ is a prime number. Prove that the equation $ x^2-py^2=-1$ has a solution if and only if $ p\equiv1\pmod 4$.
Source: Iran TST 2004
Tags: modular arithmetic, number theory proposed, number theory
Suppose that $ p$ is a prime number. Prove that the equation $ x^2-py^2=-1$ has a solution if and only if $ p\equiv1\pmod 4$.