<s>[INST] Is $\mathbb{Z}[√13] $ a Unique factorization domain? I think it is not so as $12 $ can be written in two ways $12=2.6=(1+\sqrt{13})(-1+\sqrt{13})$. Are these two factorization unique upto irreducibles? Please help.
 [/INST] $\mathbf{2}$ is Irreducible in $\boldsymbol{\mathbb{Z}\!\left[\sqrt{13}\right]}$
Suppose that
$$
\left(a+b\sqrt{13}\right)\left(c+d\sqrt{13}\right)=2\tag1
$$
where $2\nmid\left(a+b\sqrt{13}\right)$ and $2\nmid\left(c+d\sqrt{13}\right)$. Then
$$
ac+13bd=2\tag2
$$
and
$$
ad+bc=0\tag3
$$
If $2\mid a$, then since $2\nmid\left(a+b\sqrt{13}\right)$, we must have $2\nmid b$. Then $(2)$ says that $2\mid d$ and $(3)$ says that $2\mid c$. However, this means that $2\mid\left(c+d\sqrt{13}\right)$, which contradicts the hypotheses. Therefore, $2\nmid a$. Similarly, $2\nmid c$.
Multiplying $(2)$ by $ac$ and applying $(3)$ to eliminate $d$ gives
$$
a^2c^2-13b^2c^2=2ac\tag4
$$
and therefore,
$$
(ac-1)^2-1\equiv b^2c^2\pmod4\tag5
$$
However, since $a,c\equiv1\pmod2$, we must have $(ac-1)^2-1\equiv3\pmod4$. Since $3$ is not a quadratic residue mod $4$, $(5)$ can have no solutions.
Thus, $2$ is irreducible in $\mathbb{Z}\!\left[\sqrt{13}\right]$.

$\boldsymbol{\mathbb{Z}\!\left[\sqrt{13}\right]}$ is not a UFD
$$
\left(\sqrt{13}-3\right)\left(\sqrt{13}+3\right)=2\cdot2
$$
</s>