# How to show that $a^2+ab+b^2<p$ for integers $a,b$?

So I am trying to prove that $$p\equiv 1\pmod{3}$$ implies that there exists integers $$a,b$$ such that $$p=a^2+ab+b^2.$$

First using quadratic reciprocity we have the existence of integer $$d$$ such that $$d^2\equiv -3\pmod{p}.$$ Next I constructed a set $$S=\{a-zb:a,b\in \mathbb{Z}, 0\leq a,b<\sqrt{p}\}.$$ where $$z\equiv \frac{d-1}{2}\pmod{p}.$$ This is following the answer given to the following question. I can't use Minkowski's theorem since we have not seen it in our course. Next, using pigeonhole principle we can claim the existence of two integers $$a'-qb'$$ and $$a''-qb''$$ such that $$a'-qb'\equiv a''-qb''\pmod{p}$$ and so we let $$a=a'-a''$$ and $$b=b'-b''$$ then we have that $$a\equiv qb\pmod{p}.$$ From this we show that $$a^2+ab+b^2\equiv 0\pmod{p}.$$ But then the estimate, $$a^2+ab+b^2<3p$$ is not helpful in deducing that $$a^2+ab+b^2=p.$$ Is there a way of fixing this argument?

Extra: I also tried to show this using another thread that I found here. We can show that given $$p\equiv 1\pmod{p}$$ there exists $$x such that $$p|x^2+x+1.$$ So now if $$p|x-\omega$$ in $$\mathbb{Z}[\omega]$$ then $$x-\omega = p(a+b\omega)$$ which would imply that $$x=pa$$ which is not possible. So then $$p\not|(x-\omega)$$ and similarily $$p\not|(x-\omega^2).$$ Thus, $$p=mn$$ for $$N(m),N(n)>1$$ Then $$N(m)=p$$ since $$N(m)|p^2.$$ Thus we have that $$a^2-ab+b^2=(-a)^2+(-a)(b) + b^2=p.$$ I am not sure if this argument works, but this was just another direction I was exploring.

• if $a^2+ab+b^2=2p$ then $a$ and $b$ must both be even, so divide them both by $2$ – J. W. Tanner Nov 26 '19 at 23:10
• @J.W.Tanner Oops, I am sorry that makes sense. Thanks for pointing this out. Do you think this construction is correct? – nls Nov 26 '19 at 23:11
• Well if you try mod 3, you'll find that if $a\equiv b\pmod 3$ that the sum is 0 mod 3. However every other time it's 1 mod 3. – user645636 Nov 27 '19 at 1:03
• @RoddyMacPhee That allows you to show the converse of what I am trying to show. – nls Nov 27 '19 at 11:38
• okay, what it shows is your first paragraph is at least possible in theory, where as before you didn't know, also your title is different. – user645636 Nov 27 '19 at 12:10