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.

  • $\begingroup$ If $(x,y)$ is a solution, then as well as $(-x,-y)$, you also get $(y,x)$ and $(-y,-x)$, unless $|y|=|x|$. $\endgroup$
    – TonyK
    Aug 11, 2020 at 18:25
  • $\begingroup$ @TonyK: Yeah, I found that symmetry too. What's remarkable to me is that there always seem to be the "right" combination of solutions to make the total number divisible by 6. For example, when $m = 3$, there are two solutions with $|y| = |x|$ and four with $|y| \neq |x|$ (all related by the above symmetries. When $m = 13$, there are 12 solutions, all of which have $|x| \neq |y|$. Somehow, the number of four-fold symmetric solutions is always "correctly" balanced out by a two-fold symmetric solution to make the total number of solutions divisible by 6. $\endgroup$ Aug 11, 2020 at 19:03

3 Answers 3


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$.

  • 1
    $\begingroup$ Neat solution, and one that really shows the underlying structure. If I've done my calculations correctly, it looks like the solutions related in this way are $\pm(x,y)$, $\pm(y, -x-y)$, and $\pm(-x-y, x)$. By the method of construction, these are all automatically distinct unless $x = y = 0$. $\endgroup$ Aug 11, 2020 at 23:05

Observe that,


Therefore $(x,y)$ is a solution then so is $(x+y,-y)$.

We consider the following cases

Case 1

When $x=y=k$ then $$(k,k), (-k,-k), (2k,-k), (-2k,k), (-k,2k), (k,-2k)$$ are $6$ distinct solutions.

Case 2

If $y=0$ but $x\neq0$ then $$(x,0),(-x,0),(x,-x),(-x,x),(0,x),(0,-x)$$ are $6$ distinct solutions. This also works when $x=-y$.

Case 3

Otherwise, for $|x|\neq |y|$ and $xy\neq 0$, $$(x,y),(-x,-y),(y,x),(-y,-x),(x+y,-y),(x+y,-x),(-x-y,x),(-x-y,y),(-x,x+y),(-y,x+y),(x,-x-y),(y,-x-y)$$ are all $12$ distinct solutions.

  • 1
    $\begingroup$ What if $y = 0$? Then $(x, y)$ and $(x+y,-y)$ aren't distinct solutions. $\endgroup$ Aug 11, 2020 at 18:57
  • $\begingroup$ I have added that case. See. $\endgroup$
    – ShBh
    Aug 11, 2020 at 19:02
  • $\begingroup$ @MichaelSeifert I have added all cases. $\endgroup$
    – ShBh
    Aug 11, 2020 at 19:09
  • 1
    $\begingroup$ nice approach (+1) $\endgroup$
    – G Cab
    Aug 11, 2020 at 19:27

If $(x,y)$ is a solution then so are all of $$\{(x,y),(-x,-y),(y,x),(-y,-x),(-x,x+y),(x,-x-y)\}$$ which are all distinct unless $x$ and $y$ fall within a set of the form $$\{(z,z),(-z,-z),(-z,2z),(z,-2z),(2z,-z),(-2z,z)\}$$ so that we always have a multiple of $6$ solutions.

  • $\begingroup$ Are all of the solutions in your first set necessarily distinct? For example, if $x = 0$, then $(x, y) = (-x, x+y)$ and $(-x, -y) = (x, -x-y)$. Maybe I've misunderstood your second comment? $\endgroup$ Aug 11, 2020 at 18:54
  • $\begingroup$ @MichaelSeifert It seems you are correct. If $x=y=0$ then $m=0\not\in\mathbb{N}$. Otherwise WLOG $y=0$ and we have distinct solutions$$\{(x,0),(-x,0),(0,x),(0,-x),(-2x,x),(2x,-x)\}$$ $\endgroup$ Aug 11, 2020 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .