# Primes of the form $x^2 +ny^2$ where swapping $x$ and $y$ still gives a prime

I am studying primes of the form $x^2+ny^2$, and i was wondering if there are any known results about the primes of this form such that when you swap $x$ and $y$ you also get a prime. ie for $y^2+nx^2$ you get another prime, I have found quite a lot of these primes and was wondering if there might be infinitely many of these pairs of primes.

For $n=2$ I have found for example: $11, 43, 59, 67, 83, 107, 139, 163, 179, 211, \ldots$, all of these primes can be written as $x^2+2y^2$ and for these values of $x$ and $y$, $y^2+2x^2$ is also a prime.

Thank you!

• I don't know the answer to your question, but I would guess that a good place to start would be David Cox's book Primes of the form $x^2+ny^2$. – Arturo Magidin Jun 2 '11 at 19:53
• Is your list complete? I found 3,11,19,43,59,67,83,107,139,163,179,211,251,307,331,419,443,... – lhf Jun 3 '11 at 0:37
• Thank you for the help I do have that book, you're right my list was missing some primes, and yeah i had noticed the 3 mod 8 relationship, but I'm more interested in the general case, I wondered if for any n there are infinitely many of these prime pairs, or if this statement is a result of a known conjecture. – Chris Birkbeck Jun 3 '11 at 9:14
• @Chris: please do not use answers to make comments. – Qiaochu Yuan Jun 3 '11 at 10:13

## 1 Answer

This could make a nice trick question:

Prove or disprove if $$p=x^2+2 y^2$$ is a prime which is $$3 \mod 8$$, then $$y^2+2x^2$$ is prime.

The answer is "disprove". The first counter-example I can find is $$p=131$$, which is $$9^2+2 \times 5^2$$, where $$5^2+2 \times 9^2 = 187=11 \times 17$$. As I will explain below, there is a good reason where there are no significantly smaller counter-examples.

First of all, let me explain the $$3 \mod 8$$ business. An odd prime is of the form $$x^2+2 y^2$$ if and only if it is $$1$$ or $$3 \mod 8$$. If $$p$$ is $$1 \mod 8$$, then $$y$$ is even and $$y^2+2x^2$$ is not prime. So the only primes we need to care about are the ones which are $$3 \mod 8$$.

Let $$z=y^2+2x^2$$ and let's think about what a prime divisor $$q$$ of $$z$$ could look like. $$z$$ is odd, so $$q$$ isn't $$2$$. Also, $$x^2+2y^2$$ is divisible by $$3$$ if and only if $$y^2+2 x^2$$ is, so $$q$$ isn't $$3$$. Since $$x^2+2y^2$$ is prime, $$x$$ and $$y$$ are relatively prime. So $$q$$ divides neither $$x$$ nor $$y$$ and we can change $$y^2+2x^2 \equiv 0 \mod q$$ into $$y^2 \equiv -2x^2 \mod q$$. So $$-2$$ is a square modulo $$q$$, meaning that $$q$$ is $$1$$ or $$3$$ mod $$8$$.

To give a counter-example, $$z$$ must be a number which is $$3 \mod 8$$, not divisible by $$3$$, and has all prime factors equal to $$1$$ or $$3 \mod 8$$. The first such number is $$187$$ and, sure enough, that gives a counter-example. In fact, it gives two: $$187$$ is also $$13^2+2 \times 3^2$$, and $$3^2+2 \times 13^2 = 347$$, which is prime. Some other values worth trying are $$17 \times 19 = 323$$, $$11 \times 41 = 451$$ and $$17 \times 43 = 731$$.

Here is the experiment I would do if I wanted to pursue this further: Generate a collection of random pairs $$(x,y)$$ with $$x$$ and $$y$$ both odd, relatively prime, and exactly one of $$(x,y)$$ divisible by $$3$$. (Just generate random integers between, say $$1$$ and $$10^4$$ with the right properties modulo $$2$$ and $$3$$, and reject pairs which have a common factor.) Compute the proportion of pairs for which $$x^2+2y^2$$ is prime, call this proportion $$p$$, and the proportion of pairs for which $$x^2+2 y^2$$ and $$y^2+2 x^2$$ are both prime, call that proportion $$q$$.

I would bet $$q$$ is pretty close to $$p^2$$. If so, I think that the obvious explanation covers all there is to see here.