<s>[INST] Primes congruent to 1 mod 6 I came across a claim that I found interesting, but can't seem to prove for some reason. I have the feeling it should be easy
a prime $p$ can be written in the form $p = a^2 -ab +b^2$ for some $a,b\in\mathbb{Z}$ if and only if $p\equiv 1\bmod{6}$
 [/INST] $$(a,b)^2\mid(a^2-ab+b^2)\implies a^2-ab+b^2$$ can not be prime if $(a,b)>1$
Now, $a$ can be of the form $3m,3m+1$ or $ 3m-1$ where $m$ is an integer.
Similarly, $b$ can be $3n,3n+1$ or $3n-1$ where $n$ is an integer.
$(1)$ If $a=3m,a^2-ab+b^2\equiv b^2\pmod 3$
Now, $b^2\equiv0\pmod 3\iff 3\mid b\implies 3\mid(a,b)$ which is impossible as $(a,b)=1$
So, $b^2\equiv1\pmod 3\implies a^2-ab+b^2\equiv1\pmod 3$
$(2a)$ If $a=3m+1, b=3n-1, a^2-ab+b^2\equiv 1-1(-1)+1\equiv0\pmod 3\implies 3\mid p$
But $a^2-ab+b^2>3$ for $a,b>2$ hence in this case will be composite.
$(2b)$  If $a=3m+1, b=3n+1, a^2-ab+b^2\equiv 1-1(1)+1\equiv1\pmod 3$
Clearly,
$(2c),a=3m+1,b=3n\implies a^2-ab+b^2\equiv 1\pmod 3$
$(3a),a=3m-1,b=3n\implies a^2-ab+b^2\equiv 1\pmod 3$
$(3b),a=3m-1,b=3n+1\implies a^2-ab+b^2\equiv 0\pmod 3$
$(3c), a=3m-1,b=3n-1\implies a^2-ab+b^2\equiv1\pmod 3$
So, prime $p=a^2-ab+b^2\equiv1\pmod 3$ for $a,b>2$
Now, $p\equiv1\pmod3\implies p\equiv1,4\pmod 6$
Hence, $p\equiv1\pmod 6$  as $p\equiv4\pmod 6$ is even and $p>2$
</s>