What is the necessary and sufficient conditions for a Eisenstein integer to be a perfect square? The ring of Eisenstein integers is defined by $\mathbb{Z}[\omega] = \{a+b\omega~|~a,b\in \mathbb{Z} ~\text{and}~\omega=\frac{-1+\sqrt{3}i}{2}=e^{2\pi i/3}\}.$ We note that $\omega$ satisfies $1+\omega+\omega^2=0,$ thus it is a quadratic algebraic integer. I am curious to know about the necessary and sufficient condition for any Eisenstein integer $z$ to be a square. It is to be noted that if $z = (a+b\omega)^2$ for some $a,b\in \mathbb{Z}.$ Then
$$ z = (a+b\omega)^2=a^2+b^2\omega^2+2ab\omega = a^2-b^2+(2ab-b^2)\omega.$$
What can be derived from this about $z$ to be a perfect square in $\mathbb{Z}[\omega]?$
 A: You can do it just like in $\Bbb Z$, so here is a 2-fold answer, one algebraic and one arithmetic:$\def\sgn{\operatorname{sgn^+}}
\def\w{\omega}$
Algebraic
Factorizing $z\neq0$ into prime elements $\pi_i$ gives the representation
$$z= \epsilon^{a_\epsilon} \prod \pi_i^{a_i}$$
where $\epsilon$ is a unit in $\Bbb Z[\w]$ and $a_\epsilon\in\{0...5\}$. As $\Bbb Z[\w]$ is a principal ideal domain, this representation is unique up to the ordering of the $\pi_i$'s. (The prime elements are only determined up to units, but that does not affect the exponents.  And once we fixed the prime elements, that ambiguity has gone.)
Then

$z \text{ is a square } \Leftrightarrow \text{ all } a_i \text{ are even}$

Arithmetic
This follows $\Bbb Z$ again.  In order to determine whether a natural number is a square, there are root-finding algorithms that are exact when the input is a perfect square, i.e. these algorithms can discriminate between non-squares and squares, and output the exact square root in the latter case.
Thus the algorithm goes as follows:

*

*Represent $z$ as $z=x+iy$.


*Compute the complex square root of $z$ according to
$$\sqrt z = \sqrt\frac{|z|+x}2 + i\sgn(y)\sqrt\frac{|z|-x}2 \tag 1$$
This is the principal branch of the complex square root where
$$\sgn(y) = \begin{cases}
+1, & \text {if } x \geqslant 0\\
-1, & \text {if } x < 0\\
\end{cases}$$


*Check whether that root takes the desired form $a+b\w$.
Step 3 is a bit more complex than in the real case: The result is only determined up to a factor of $\pm1$.
And you'll have to deal with factors of 1/2 at some place, which means that the square roots in (1) might give half-integer values. To simplify matters, you can check for radicands of the form $\sqrt{4r}$ instead of $\sqrt r$, so that the roots are plain integers, and only after taking square roots divide by 2. (When returning to $a+b\w$ form, the 1/2 terms will finally go away again.)
Note: From (1) one concludes that $|z|$ must be rational, and more specific that $|z|\pm x$ must be a multiple of a half-integer:
$$|z|\pm x = 2^{2n-1}m \quad \text{ with } n,m\in \Bbb N_0, \text{ and } m \text{ is odd or zero}$$
