Inspired by this question on Mathematica StackExchange:
Consider the set of integer solutions $x, y \in \mathbb{Z}$ to the equation $x^2 + xy + y^2 = m$, for $m \in \mathbb{N}$. Conjecture: the number of distinct solutions to this equation is divisible by 6 for all integer $m$.
I have done a brute-force calculation in Mathematica for $m \leq 10^4$, and have not found any counterexamples. For example, there are:
- 0 integer solutions for $m = 2$;
- 6 distinct solutions for $m = 3$ [$(x,y) = \pm (2, -1)$, $(x,y) = \pm (-1, 2)$, and $(x,y) = \pm (1, 1)$];
- 12 distinct solutions for $m = 7$;
- 18 distinct solutions for $m = 49$;
and so forth. The largest number of solutions Mathematica found was 54 solutions, for $m = 8281$. All of these are divisible by 6.
Is there a counterexample to this conjecture for some larger value of $m$? Or can the conjecture be proven?
I suspect that a proof will involve some kind of hidden symmetry of the polynomial $x^2 + xy + y^2$ that maps integer solutions to integer solutions; but I haven't been able to nail it down. It's not hard to see that the number of solutions must be even (if $(x,y)$ is a solution, then so is $(-x, -y)$, and these are distinct unless $x = y = 0$); but the divisibility by 6 is much more mysterious to me.
This is a slightly different approach to your problem. Let $\omega$ be the cube root of unity. Then $$x^2+xy+y^2=(x-\omega y)(x-\omega^2 y)=m.$$ If this has a solution, then it means there exists an element $\alpha=x-\omega y$ in the ring $\Bbb{Z}[\omega]$ such that its norm $N(\alpha)=m$. But if you consider the six units of the ring $\Bbb{Z}[\omega]$, they are $\{\pm 1, \pm \omega, \pm \omega^2\}$, then the norm of $\alpha u$, where $u$ is a unit is also $m$. So for every solution $\alpha$ you have six solutions namely, $\pm\alpha, \pm\omega \alpha, \pm \omega^2 \alpha$.