$a^2−ab+b^2=c^2$. Show prime factors of $c$ are of the form $6k + 1$ I encountered this question in Number Theory by Naoki Sato.
Let a, b, and c be positive integers that are pairwise relatively prime,
and that satisfy $a^2−ab+b^2=c^2$. Show that every prime factor of c is
of the form $6k + 1$.
Attempt:
Since primes are either of the form $6k+1$ or $6k-1$, I tried to show $p \equiv 1 \pmod6$ by showing $p \equiv 1 \pmod2$ and $p \equiv 1 \pmod3$ but I am unable to show $p \equiv 1 \pmod3$.
Another direction I tried was to assume there exist a prime factor $p$ of $c$ with $p=6k-1$.
By brute force I know that $a^2−ab+b^2 \equiv 0, 1, 3$, or $4 \pmod6$ but I can't see how to get a contradiction from here.
I am not sure how to use the condition that all 3 numbers are pairwise coprime.
Any help is much appreciated!
 A: Suppose $p \mid c$, so that $a^2 - ab + b^2 \equiv 0 \pmod{p}$.  That implies that $a^3 + b^3 \equiv 0 \pmod{p}$.  By the assumption that $a$ and $b$ are each relatively prime to $c$, we have that $p \nmid a, b$, so $-a b^{-1}$ has cube equal to 1 in $\mathbb{Z} / p \mathbb{Z}$.  Also, if it were the case that $a \equiv -b \pmod{p}$, then we would have $3 a^2 \equiv a^2 - ab + b^2 \equiv 0 \pmod{p}$, giving a contradiction (as long as $p\ne 3$; but in this case, for example if $a = 3m+1$ and $b=3n-1$, then $a^2 - ab + b^2 = 9m^2 - 9mn + 9n^2 -9m + 9n + 3 \equiv 3 \pmod{9}$ contradicting the fact that $3 \mid c^2$ implies $9 \mid c^2$).  Therefore, $-a b^{-1}$ has order exactly three in the group of units of $\mathbb{Z} / p \mathbb{Z}$, implying that 3 divides $|(\mathbb{Z} / p \mathbb{Z})^*| = p-1$.
A: Here is a proof based on quadratic reciprocity.
Suppose $p=3k-1|a^2-ab+b^2$ with $a,b$ relatively prime.  Neither $a$ nor $b$ can have zero residue $\bmod p$, else they both would which the hypothesis denies.  Thus there exists a nonzero residue $r\equiv ab^{-1}\bmod p$ such that $r^2-r+1\equiv 0$.  Multiplying by $4$ and completing the square gives $(2r-1)^2\equiv -3$.  Therefore the Legendre symbol  $(-3|p)=+1$ if $p$ is as assumed above.
But $(p|3)=(3k-1|3)=-1$ and $-3\equiv +1\bmod 4$, so QR forces the contradictory conclusion $(-3|p)=-1$.
The case $p=3$ remains and this is a bit tricky.  There are multiples of $3$ having the form $a^2-ab+b^2$ where $a$ and $b$ are relatively prime.  We just need $a\equiv -b\bmod 3$ because $a^2-ab+b^2\equiv (a+b)^2\bmod 3$. But, if $a\equiv -b\bmod 3$ with the common residue being $1$ or $2$, we find that $c^2\equiv 3\bmod 9$ which doesn't work.
A: Here is an algebraic theoretical proof parallel to the "gaussian" proof of Fermat's theorem on sums of squares. You may find it too complicated, but actually the general trend in math is to try to embed particular questions into larger and larger general theories in order to solve in one stroke whole families of problems which are of the same nature (*)
First replace the Gauss ring $\mathbf Z[i]$ by the Eisenstein ring $E=\mathbf Z[j]$, which is the ring of integers of the quadratic field $\mathbf Q(j)$, where $j$ is a primitive 3rd root of unity. It is classically known that $E$ is a principal ideal ring, so the theory of division in $E$ for ideals and for elements is the same up to the units of $E$, which are plainly the powers of $\pm j$. The prime elements (ideals) of $E$ are deduced from those of $\mathbf Z$ in the following manner : a prime $p$ of $\mathbf Z$ does not necessarily remain prime in $E$, but it can decompose only in 3 possible ways : (1) $p$ is inert, i.e. remains prime, iff $p\equiv 2$ mod $3$ ; (2) $p$ splits, i.e. $p=\pi\bar\pi$ (where $\pi$ is a prime of $E$) iff $p\equiv 1$ mod $3$ ; (3) $p$ ramifies in $E$, i.e. $p=\pi^2$ iff $p=3$ (see any textbook in ANT).
Now the equation $a^2-ab+b^2=c^2$ in $\mathbf Z$ reads $(a+bj)(a+bj^2)=c^2$ in $E$, where the UFD property implies that the prime divisors $\pi$ of $c$ are exactly such that $\pi$ divides $a+bj$, say, and the conjugate $\bar \pi$ divides $a+bj^2$. By uniqueness again, $\pi\bar \pi$ will divide $c$, i.e. the rational primes $p$ which divide $c$ must split.
(*) An archetypical example lies in the attempts to solve FLT by the same approach as above. Actually Kummer showed FLT along these lines - but of course with more involved arguments -  in the so called regular case, i.e. when the ring $\mathbf Z[\zeta_p]$ (where $\zeta_p$ is a primitive $p$-th root of unity) is principal.
