The number of solutions to $x^2-xy+y^2=n$ is finite and a multiple of 6. Let be $n$ a positive integer. Show that the number of integers solutions $(x,y)$ of the following equation $$x^2-xy+y^2=n$$ Is finite and multiple of 6.
My approach: If $(x,y)$ is a integer solution of  $x^2-xy+y^2=n$ ,then also is $\{(-x,-y),(y-x,-x),(-y,x-y),(x-y,x),(y,y-x)\}$; But this solutions was find only by the simetry of equation. So, I can't ensure these solutions are all integers solutions for the problem. Can give me some hint. Thanks!
 A: Any solution $(x,y)$ can be transformed into a different solution $(x-y, x)$. Applying this transform repeatedly gives:
$$\begin{align}
 (x &,y) \\
(x-y &, x)\\
(-y &, x-y) \\
(-x &, -y) \\
(y-x &, -x) \\
(y &, y-x)\\ 
\end{align}$$
and back to the original - thus the divisibility by $6$. 
Clearly the solutions are finite; for example $(x-y)^2 = x^2-2xy+y^2\ge 0$ and thus as $x^2-xy+y^2 > xy$ and since the same-sign case is smaller than the mixed-sign case, we need $|xy|\le n$
A: Let's multiply the equation by $2$ to get
$$
2x^2-2xy+2y^2=x^2+y^2+(x-y)^2=2n.
$$
Clearly $x^2$ and $y^2$ are bounded by $2n$, thus the number of solutions is finite.
Consider the triple $(x,y,z=x-y)$. If all three numbers are different then we can get 6 different solutions by doing all permutations of those and possibly adjusting one sign to negative to satisfy the relation "the last is the first minus the second". Besides those we can get another 6 solutions by changing all the signes. It gives 12 solutions in this group. A special case is when not all three are different, but in this case the number of unique solutions reduces by factor two, and we get a group of only 6 solutions.
A: I prefer, as suggested by @Daniel Fisher, to do arithmeic in the so called ring of Eisenstein integers $\mathbf Z[j]$, where $j$ is a primitive cubic root of $1$. It is known that this ring is a UFD. Recall that division in a domain is defined up to units (= invertible elements), which are here the obvious $6$-th roots of $1$ in $\mathbf Q[j]$. 
Now let $N$ be the norm map of the extension $\mathbf Q[j] / \mathbf Q$. Your diophantine equation can be written ($E_n)$ $N(x+jy) =n$ (necessarily positive). Because the norm is multiplicative, and  $\mathbf Z$ and $\mathbf Z[j]$ are UFD's, it is obviously sufficient to solve only equations of the type ($E_p$) $N(x+jy) =p$, where $p$ is a prime factor of $n$ . Note that the existence of a solution of ($E_p$) means that the prime $p$ splits as a product of 2 non associated irreducible elements in $\mathbf Z[j]$, and this is known to happen iff $p\equiv 1$ mod $3$. Anyway, the number of solutions $(x,y)$ of ($E_n)$ is readily $\equiv 0$ mod $6$ because of the $6$-th roots of $1$ in $\mathbf Q[j]$. 
