Let $p$ be prime and $0<a< p$ an integer such that $$ \Big({a\over p}\Big) =1$$ Then there exists integers $x,y$ such that $p=x^2-ay^2$.
Edit: For which primes is this true? From CalebKoch answer we see this is not true in general. Can you sugest me a literature where I can find a theory of this. I suspect, if it is true, then it has something to do with a Thue theorem. http://mathworld.wolfram.com/ThuesTheorem.html
A found this interesting results:
https://en.m.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares
I don't think this is true. Consider the following counter example: let $p=11$ and $a=3$. Then $a$ is a quadratic residue mod $p$ since $3\equiv 5^2\pmod{11}$. Consider then the equation $11=x^2-3y^2$. Taking this modulo 3 gives $2\equiv x^2 \pmod{3}$. No such $x$ exists so the equation cannot be satisfied.