Is the representation of any prime of the form $6n+1$ as $a^2+3b^2$ essentially unique? Two well-known results in number theory are:

Fermat's $4n+1$ theorem: Every prime of the form $4n+1$ can be represented as $a^2+b^2 (a,b \in\mathbb{N})$.


Euler's $6n+1$ theorem: Every prime of the form $6n+1$ can be represented as $a^2+3b^2 (a,b \in\mathbb{N})$.

Looking at the Mathworld entries on these theorems here and here, I notice that representation of primes of the form $4n+1$ is stated to be unique (up to order), but that there is no mention of uniqueness in respect of representation of primes of the form $6n+1$.  Uniqueness does however seem to hold at least for small primes of this form.
Question: Is the representation of any prime of the form $6n+1$ as $a^2+3b^2$ essentially unique?
If this is the case then a reference to a proof would be appreciated.

This follows from very old results on representations of integers by quadratic forms. In particular it is a special case of a result of Euler which shows that two essentially distinct representations of $\,m\,$ imply  $\,m\,$ is composite $ $ (the proof constructs a proper factor of $\,m\,$ via a quick gcd computation). $\, $
Appended below is a classic elementary proof of Euler's result that requires no knowledge of ideal theory of quadratic number fields. It is excerpted from Wieb Bosma's thesis (1990) pp. 14-16 (which has a nice concise historical introduction to primality testing). It deserves strong emphasis that the arithmetical essence of this proof is much clearer when it is translated into the language of quadratic number fields and their ideal theory - as is often the case for such results. The use of ideals essentially simplifies such (nonlinear) quadratic (form) arithmetic by linearizing it into arithmetic of ideals (modules) - making available analogs of the powerful tools of linear algebra.
As hinted in the final few paragraphs below, this result was part of Euler's research on idoneal numbers for primality testing. For more on such see Ernst Kani's paper.




[10] Z.I. Borevich, I. R. Shafarevich, Number Theory, Orlando: Academic Press 1966.
[159] A. Weil, Number theory, an approach through history, Boston: Birkhauser 1984.
