# The sum of a square and twice a square

Consider the set $\{3,6,9,11,12,17,18,19,22\ldots\}$ (OEIS A154777) of positive integers that are expressible in the form $a^2 + 2b^2$. Is there a theorem about the form of such numbers analogous to the one about integers representable in the form $a^2 + b^2$? Is there a way to relate this problem to that one?

Some numbers, such as $27, 33, 51, 54,\ldots$ are expressible in the form $a^2 + 2 b^2$ in more than one way. Is the set of such numbers infinite? (OEIS search for this sequence finds nothing.) It appears that all such numbers are divisible by 3; is there a proof of this? What else is known about this?

(Mercio observes in a comment that $121 = 11^2 + 2\cdot0^2 = 7^2 + 2\cdot6^2$ is not divisible by 3; another example is $209 =3^2 + 2\cdot 10^2 = 9^2 + 2\cdot 8^2$.)

-
You might be able to get something similar to the $a^2+b^2$ case using the factorization $a^2+2b^2=(a+b\sqrt{-2})(a-b\sqrt{-2})$. $\Bbb{Z}[\sqrt{-2}]$ is a UFD, so things should work out nicely. – Chris Eagle Mar 15 '13 at 21:09
That idea leads to investigating when $-2$ is a square mod $p$, which leads to MJD's answer. – Chris Eagle Mar 15 '13 at 21:14
I would count $2$, $4$, and many others expressible, there is no reason to insist that $a$, $b$ are non-zero. The analysis is the same as for sum of two squares. The expressible odd primes are all those congruent to $1$ or $3$ mod $8$. There are infinitely many numbers expressible in more than one way. And they are not all divisible by $3$. – André Nicolas Mar 15 '13 at 21:15
It looks like you're leaving out the numbers arising when $a$ or $b$ is zero. The numbers which are expressible in more than one way aren't necessarily divisible by $3$ - take $666434 = 24^2 + 2 \cdot 577^2 = 72^2 + 2 \cdot 575^2$. – Cocopuffs Mar 15 '13 at 21:22
$$11 \cdot 17 = 187 = 13^2 + 2 \cdot 3^2 = 5^2 + 2 \cdot 9^2$$ – Will Jagy Mar 15 '13 at 21:29

According to OEIS,

$n$ belongs to this sequence iff every prime $p \equiv 5,7 \pmod 8$ dividing $n$ occurs to an even power.

So the answer to my question "Is there a theorem analogous to the one about $a^2+b^2$?" is "Yes".

-
I prefer saying that $n$ is representable iff its coprime factors are congruent to $1,3 \pmod 8$. Also, $121 = 11^2+2.0^2 = 7^2+2.6^2$ but $121$ is not a multiple of $3$. – mercio Mar 15 '13 at 21:17

$$(a^2 + 2 b^2)(c^2 + 2 d^2) = (ac+2bd)^2 + 2 (ad-bc)^2 = (ac-2bd)^2 + 2 (ad+bc)^2$$ so you get multiple representations as soon as you have the product of two distinct represented odd primes, that is $\equiv 1,3 \pmod 8.$ You kind of lose if 2 is involved because of the evident $0,$ also you get the analogue of Pythagorean triples for the square of any odd represented prime, as in mercio's comment.

The presence of such a simple formula for multiplication is just that this is the principal form (binary quadratic forms) of this discriminant. The fact that it is simple to describe the represented primes is the fact that this is class number one. That is, there is only one genus, the principal one, and there is only one (equivalence class of) forms in that genus. It is still not too bad when you have one form per genus but more than one genus, as in $x^2 + 6 y^2$ and $2 x^2 + 3 y^2.$ But then the description of all numbers that are represented by the principal form includes an extra odd/even check about the sum of certain prime exponents.

-