# If $p$ is prime, then $x^2 +5y^2 = p \iff p\equiv 1,9$ mod $(20)$.

Let $$p\neq 2,5$$ be prime. I wish to show that: $$x^2 +5y^2 = p \Leftrightarrow p\equiv 1,9$$ mod $$(20)$$.

I proved to $$\Rightarrow$$ part, means $$x^2 +5y^2=p \Rightarrow p\equiv 1,9$$ mod $$(20)$$.

For $$\Leftarrow$$ , $$p\equiv 1,9(20) \Rightarrow p\equiv 1(4)$$ , $$p\equiv1 ,4 (5)$$ thus $$(\frac{4}{p})=1,(\frac{-1}{p}) =1$$ (using legendre symbols) , also $$(\frac{5}{p})=_{p\equiv1(4)}(\frac{p}{5})$$ and $$p\equiv1(5)$$ so $$(\frac{5}{p})=1$$ , so $$(\frac{-20}{p})=(\frac{5}{p})(\frac{4}{p})(\frac{-1}{p}) = 1$$. So $$-20$$ is a quadratic residue mod $$p$$.

Yet I don't succeed to go on from this point (I don't know even if its possible to do so).

• See Cox primes of the form x^2+ny^2 – Kenny Lau Jan 2 '19 at 10:09

Let $$p\equiv1$$ or $$9\pmod{20}$$. Then $$-5$$ is a quadratic residue modulo $$p$$, so there are integers $$r$$ and $$s$$ with $$r^2+ps=-5.$$ This means that the integer quadratic form $$f(X,Y)=pX^2+2rXY+sY^2$$ has discriminant $$-20$$ and is also positive definite. Then $$p$$ is represented by $$f$$. Now $$f$$ is equivalent to a reduced form. There are two reduced forms of discriminant $$-20$$: $$g_1(X,Y)=X^2+5Y^2$$ and $$g_2(X,Y)=2X^2+2XY+3Y^2$$. But $$g_2$$ cannot represent any number congruent to $$1$$ or $$9$$ modulo $$20$$. Therefore $$g_1$$ represents $$p$$.
• Sorry but I am not familiar with the terminology of "reduced form" and $f$ which represents prime. May you please suggest a good source for me to read about it? – dan Dec 31 '18 at 8:36
• For questions of this type,you'll find all you need in D. Cox's marvelous book, "Primes of the form $x^2+ny^2"$ – nguyen quang do Jan 2 '19 at 17:33
An alternative solution: the class number of $$K=\mathbb{Q}(\sqrt{-5})$$ is $$2$$, its Hilbert class field is $$L=\mathbb{Q}(\sqrt{-5},\sqrt{-1})$$. A prime $$p\neq 2,5$$ can be written as $$p=x^2+5y^2$$, iff $$p$$ splits into two principal prime ideals in $$K$$, iff $$p$$ splits completely in $$L$$, iff $$p$$ splits in both $$\mathbb{Q}(\sqrt{5})$$ and $$\mathbb{Q}(\sqrt{-1})$$, iff $$\left(\frac{-1}{p}\right) = 1 \qquad \left(\frac{5}{p}\right)= \left(\frac{p}{5}\right) = 1$$ which happens iff $$p\equiv 1,9 \pmod{20}$$.
The solution using reduced binary quadratic form works here, because when $$D=-20$$ there are only one form $$x^2+5y^2$$ in the principal genus. This also happens for some other small $$|D|$$.