When is $\mathbb{Z}[\sqrt{d}]$ not an UFD (for $d>1$)?
Solution 1:
When $d \not\equiv 1\; (\textrm{mod}\; 4)$, the ring of integers of $\mathbb{Q}(\sqrt{d})$ is $\mathbb{Z}[\sqrt{d}]$. $\mathbb{Z}[\sqrt{d}]$ is a UFD if and only if it has trivial class group (i.e., the class number of $\mathbb{Q}(\sqrt{d})$ is $1$).
However, it's an open question as to whether or not there are infinitely many $d>0$ with $\mathbb{Q}(\sqrt{d})$ having class number 1, so the answer is not known.