Representation of prime number by binary quadratic form For wich prime numbers $p$ there exist integers $x,y$ such that $x^2+5y^2=p$?
For cases $x^2+y^2$ or $x^2+2y^2$ this condition is equivalent to discriminant of the form is quadratic residue modulo p, because $\mathbb{Z}[\sqrt{-1}]$ and $\mathbb{Z}[\sqrt{-2}]$ are euclidian, but my case can't be solved in this way because $\mathbb{Z}[\sqrt{-5}]$ is non-euclidian. 
 A: $x^2 + 5 y^2 $ represents primes $p=5$ or $p \equiv 1,9 \pmod {20}.$
The other form of that discriminant, $2x^2 + 2 x y + 3 y^2,$ represents $p=2$ and $p \equiv 3,7 \pmod {20}.$
For $p \neq 2,5,$ we have Legebdre symbol $(-20|p) = 1$ when $p \equiv 1,3,7,9 \pmod {20}.$ Given such a prime, we solve
$$  \beta^2 \equiv -20 \pmod p  $$
If $\beta $ is odd, replace it by $p-\beta$ which is even. So we have now
$$  \beta^2 \equiv -20 \pmod {4p}.  $$ This is
$$  \beta^2 = -20 + 4 p t $$ for some integer $t,$ or
$$ \beta^2 - 4 p t = -20.  $$
So, the binary quadratic form $$ \langle p, \beta, t \rangle  $$
has the correct discriminant. Gauss reduction takes this to either $ \langle 1,0,5 \rangle  $ or $ \langle 2,2,3 \rangle.  $ We can tell which one by $(5|p).$
Let's see; reduction is a step by step procedure for taking the Hessian matrix $H$ (second partial derivatives) of the original form to one of the choices, either diagonal with entries $(2,10)$ because of the doubling, or the other one. The resulting matrix equation is $P^T H P = G,$ where $P \in SL_2 \mathbb Z.$ But then $P^{-1}$ has also all integer entries, call it $Q = P^{-1}, $ and we have $Q^T G Q = H.$ The representation of $p$ is the left column of $Q.$
