# Primes of the form : $\sqrt{x^2+7\cdot y^2}$

How to prove following statement :

Conjecture:

Odd prime $p$ is expressible as : $p=\sqrt{x^2+7\cdot y^2}$ , $x,y > 0$

if and only if : $p\equiv 1 \pmod {7}$ or $p\equiv 2 \pmod {7}$ or $p\equiv 4 \pmod {7}$ .

Note that $7$ is an Idoneal Number .

-

First, check that $p=7$ is not expressible as such a square root.

Next, suppose $p$ is an odd prime other than $7$. $p^2 = x^2 + 7y^2$ means that $p² = (x + y \sqrt{-7})(x - y \sqrt{-7})$. So you are looking for non-trivial factorisations of $p^2$ in $\mathbb{Z}[\sqrt{-7}]$.

Note that $\mathbb{Q}(\sqrt{-7})$ has class number 1, so its ring of integers, $\mathbb{Z}[\frac{1+\sqrt{-7}}2]$, is a unique factorisation domain.

If $-7$ is a square mod $p$ then $p$ factors into $q \bar{q}$, and you have $p^2 = (q^2)(\bar q^2)$. Now, if $q = \frac{a+b\sqrt{-7}}2$ with $a$ and $b$ odd, then $a^2,b^2 \equiv 1 \mod 8$, so $q\bar{q} = \frac{a^2+7b^2}4 \equiv 0 \mod 2$. Since $p$ is odd, this can't be the case, thus you get $p^2 = (q)^2(\bar q)^2$ with $q^2, \bar{q}^2 \in \mathbb{Z}[\sqrt{-7}]$

Furthermore, write $q^2 = x+y\sqrt{-7}$, so $p^2 = x^2+7y^2$. If $x=0$ then $(p/y)^2 = 7$, which is impossible because $7$ is not a square in $\mathbb{Q}$. If $y=0$ then $q^2 = x = p$ which is impossible because $p$ is not a square in $\mathbb{Q}[\sqrt{-7}]$. Thus, changing the signs of $x,y$ if needed, $p = \sqrt{x^2+7y^2}$ with $x,y>0$.

If $-7$ is not a square mod $p$, then $p$ is irreducible, so $p^2 = p*p$ is the only possible factorization (up to sign), so $p = \sqrt{x^2+7y^2}$ implies $x= \pm p, y=0$.

The quadratic reciprocity law does the rest : $-7$ is a square mod $p$ if and only if $p$ is a square mod $7$.

-