$4q=a^2+27b^2$ elementary proof of uniqueness I’m trying to prove that if $q$ is prime then the representation $$4q=a^2+27b^2$$ is unique (up to sign). Any help would be appreciated.
Edit: By elementary I mean only using divisibility rules, modular arithmetic, etc.
 A: Hint:

$\Bbb Z[\omega]$, with $\omega^2+\omega+1=0$, is a UFD.


Suppose $$\frac{a^2+27b^2}{4}=\frac{c^2+27d^2}{4}\tag{1}$$ $\Bbb Z[\omega]$ is a UFD, so factor as $(1)$ $$\left(\frac{a+3b\sqrt{-3}}{2}\right)\left(\frac{a-3b\sqrt{-3}}{2}\right)=\left(\frac{c+3d\sqrt{-3}}{2}\right)\left(\frac{c-3d\sqrt{-3}}{2}\right)$$ Each factor is a prime in $\Bbb Z[\omega]$ since $N\left(\frac{a+3b\sqrt{-3}}{2}\right)=q$, therefore the factors are associates.

Can you take it from here?
A: Suppose that $4q=a^2+27b^2=c^2+27d^2$ and $a,b,c,d> 0$ (equals 0 is not possible).
We have $a^2d^2-b^2c^2\equiv 0 $ mod $q$.
Then $(ad-bc)(ad+bc)\equiv 0$ mod $q$.
If $ad+bc\equiv 0$ mod $q$, then by $16q^2=(a^2+27b^2)(c^2+27d^2)=(ac-27bd)^2+27(ad+bc)^2$, we must have $ad+bc=0$. This is impossible, so we have $ad-bc \equiv 0 $ mod $q$.
By $16q^2=(a^2+27b^2)(c^2+27d^2)=(ac+27bd)^2+27(ad-bc)^2$,
we have $ad-bc=0$. Thus, $a/c=b/d=t$ gives
$a^2+27b^2=t^2(c^2+27d^2)=c^2+27d^2$. Hence, $t^2=1$ and $t=\pm 1$. Since $a,b,c,d> 0$, we must have $a=c$ and $b=d$.
A: Comment:
$a=b=1 \rightarrow 4q=1+27=28$  ⇒ $q=7$
$b=2$, $a=4$  ⇒ $4q=16 +27\times 4$  ⇒ $q=31$
$b=2$, $a=8$  ⇒ $q=43$
$b=2$, $a=32$  ⇒ $q=283$
$b=2$, $a=256$ ⇒ $q=16411$
