<s>[INST] Primes of the form $p=X^2+3Y^2$ I'm trying to work in $\mathbb{Z}\left[\frac{1+\sqrt{-3}}{2}\right]$ to show that an odd prime $p\in\mathbb{Z}$, $p\neq 3$ is of the form $p=X^2+3Y^2$ if and only if $p\equiv1$ mod $3$. The hint is to first show that if $p=1$ mod $3$, then both $p=u^2+3v^2$ and $4p=u^2+3v^2$ where this time, $u$ and $v$ are odd.
Using quadratic reciprocity, I showed that $-3$ is a square mod $p$, which shows that $p|x^2+3$ and thus $p$ isn't prime in $\mathbb{Z}\left[\frac{1+\sqrt{-3}}{2}\right]$, which in turn gives me that $p=X^2+3Y^2$ using the usual proof. But I dont understand where the $4p=u^2+3v^2$ comes from. Obviously this looks like elements of $\mathbb{Z}\left[\frac{1+\sqrt{-3}}{2}\right]$ after dividing by $4$ but maybe I overlooked something simple?
 [/INST] HINT.- If $p\ne3M+1$ then $p=3M-1$. But then
$$3M-1=X^2+3Y^2\Rightarrow X^2\equiv-1\pmod3$$ which is impossible because $\left(\mathbb Z/3\mathbb Z\right)^2= \{0,1\}$.
COMMENT.-Maybe this could help @Saegusa in his inquiring on $\mathbb Q(\sqrt{-3})$ mainly in $4p=u^2+3v^2$. This problem was conjectured by Fermat and proved by Lagrange and Legendre by other method.
The discriminant of the quadratic form $ax^2+bxy+cy^2$ is the number $\Delta=b^2-4ac$
Note that the discriminant of the form $x^2+3y^2$ is $-12$.
In order to solve this problem, using quadratic reciprocity, prove first that this discriminant $-12$ is a square modulo the prime $p=3m+1$.
In fact $$\left(\frac{-12}{p}\right)=\left(\frac{4}{p}\right)\left(\frac{3}{p}\right)\left(\frac{-1}{p}\right)=\left(\frac{3}{p}\right)\left(\frac{-1}{p}\right)$$ As we have $$\left(\frac{p}{3}\right)\left(\frac{3}{p}\right)=(-1)^{\dfrac{(p-1)(3-1)}{4}}=(-1)^{\dfrac{p-1}{2}}$$ multiplingt both sides by $\left(\frac{p}{3}\right)$ we get
$$\left(\frac{-12}{p}\right)=\left(\frac{p}{3}\right)(-1)^{\dfrac{p-1}{2}}(-1)^{\dfrac{p-1}{2}}=1$$  Then the equation $x^2=-12$ has solution modulo the prime $p=3m+1$.
► If $x$ is even put $Y=x$ so $Y^2\equiv{-12}\pmod p$ and $4\space|\space Y^2$
►If $x$ is odd put $Y=p-x$ so $Y^2\equiv{-12}\pmod p$ and again $4\space|\space Y^2$
Since $Y^2+12\equiv 0\pmod p$ i.e. $p\space| Y^2+12$ so $4p\space| Y^2+12$ because $4\space|\space Y^2$.
Definition.-A quadratic form $ax^2+bxy+cy^2$ with discriminant $\Delta\lt0$ is called reduced if the two following conditions hold:
$(1)|b|\le a\le c\\(2)\text{if either }  |b|=a\space \text{or }a=c \space\text{then } b\ge0$.
PROPOSITION:- The only primitive reduced quadratic form having discriminant $-12$ is the form $x^2+3Y^2$.
The end is given by considering the form $p=px^2+bxy+cy^2$ of an evident solution $(x,y)=(1,0)$ and using Lagrange's algorith of reduccion of forms choose $b$ and $c$ carefully to reduce to the form $p=x^2+3y^2$.
</s>