TITLE: The set of integers $n$ expressible as $n=x^2+xy+y^2$
QUESTION [9 upvotes]: Let $S$ be the set of integers $n$, such there exist integers $x,y$ with $$n=x^2+xy+y^2$$


Is the implication $$a,b\in S\implies ab\in S$$ true? If yes, how can I prove it?

I worked out $$n\in S\iff 4n\in S$$ and $$n\in S\iff 3n\in S$$
I tried two approaches. The first is to express $$(a^2+ab+b^2)(c^2+cd+d^2)$$ in the form $$f^2+fg+g^2$$ with polynomials $f,g$ with integer coefficients. I however could not find suitable $f$ and $g$.
The second approach is based on $$x^2+xy+y^2=\frac{(2x+y)^2+3y^2}{4}$$ If we have $n=x^2+xy+y^2$ , we have $u^2+3v^2=4n$ for some integers $u,v$ with equal parity. The main problem of this approach is to consider the equal parity.
Any ideas ?

REPLY [2 votes]: Denote $a^2+ab+b^2$ by $L(a, b)$. Numbers of the form $L$ are known as Loeschian numbers. What you are trying to prove is that the set $S$ of Loeschian numbers is multiplicative.
Here's a direct proof that the product of two Loeschian numbers is Loeschian.
\begin{align*}
L(a, b)L(c, d) &=(a^2+ab+b^2)(c^2+cd+d^2)\\
&= a^2c^2+a^2cd+a^2d^2+abc^2+abcd+abd^2+b^2c^2+b^2cd+b^2d^2\\
&=[a^2c^2+2abc^2+b^2c^2+2abcd+2b^2cd+b^2d^2]+{}\\
&\qquad +[a^2cd-abc^2+abcd-b^2c^2+abd^2-b^2cd]+{}\\
&\qquad +[a^2d^2-2abcd+b^2c^2]\\
&=(ac+bc+bd)^2+(ac+bc+bd)(ad-bc)+(ad-bc)^2\\
&=L(ac+bc+bd, ad-bc)
\end{align*}
In addition,
\begin{align*}
L(a, b)L(c, d)
&= (a^2+ab+b^2)(c^2+cd+d^2)\\
&= a^2c^2+a^2cd+a^2d^2+abc^2+abcd+abd^2+b^2c^2+b^2cd+b^2d^2\\
&=[a^2c^2-2abcd+b^2d^2]+{}\\
&\qquad +[a^2cd+abc^2+abcd-abd^2-b^2cd-b^2d^2]+{}\\
&\qquad +[a^2d^2+2abcd+b^2c^2+2abd^2+2b^2cd+b^2d^2]\\
&=(ac-bd)^2+(ac-bd)(ad+bc+bd)+(ad+bc+bd)^2\\
&=L(ac-bd, ad+bc+bd)
\end{align*}
It can also be proved that $n$ has the form $a^2+ab+b^2$ iff $n$ has the form $u^2+3v^2$. (Sketch of a proof: Where $a+b+c=0$, $L(a, b)=L(b, c)=L(c, a)$. Moreover, at least one of $a, b$ and $c$ is even. $L(a, 2v)=a^2+2av+4v^2=u^2+3v^2$ where $u=a+v$. Conversely, $u^2+3v^2=L(a, b)$ where $b=2v$ and $a=u-v$. Thus $L$ and $u^2+3v^2$ represent the same set of integers.)
Thus the set of numbers of the form $u^2+3v^2$ is multiplicative. Again there is a direct proof, and it is slightly simpler than the proof above.