Does $20$ really have three distinct factorizations in $\mathcal{O}_{\mathbb{Q}(\sqrt{-31})}$? I'm still trying to wrap my mind around the concept of $\sqrt{-1}$, though I think I've gotten to the point where my doubt is more metaphysical than mathematical. I've read a few bits of algebraic number theory books, I've done some of the exercises, and I've had those exercises checked by a math tutor at the university nice enough to help me even though I'm not currently a tuition-paying student. I've done exercises pertaining to $\mathbb{Z}[i]$, $\mathbb{Z}[\sqrt{-2}]$, $\mathbb{Z}[\omega]$, and $\mathbb{Z}[\sqrt{-5}]$. The tutor couldn't help me with this question today, though, because besides being busy with a bunch of students fretting about an exam next week, she said $\mathbb{Z}[\sqrt{-5}]$ is the only non-UFD ring she's studied because that's the only one the undergrads look at.
In $\mathcal{O}_{\mathbb{Q}(\sqrt{-31})}$, I think I have correctly verified that $$10 = 2 \times 5 = \left(\frac 3 2 - \frac{\sqrt{-31}}{2}\right) \left(\frac 3 2 + \frac{\sqrt{-31}}{2}\right)$$ represents two distinct factorizations of $10$. Then I get $$20 = 2^2 \times 5 = 2 \left(\frac 3 2 - \frac{\sqrt{-31}}{2}\right) \left(\frac 3 2 + \frac{\sqrt{-31}}{2}\right)$$
$$ = \left(\frac 7 2 - \frac{\sqrt{-31}}{2}\right) \left(\frac 7 2 + \frac{\sqrt{-31}}{2}\right).$$
But this doesn't look right to me, for one thing, because that last factorization has two factors instead of three like the other two factorizations. But I can't find numbers (besides the obvious) that multiply to $\left(\frac 7 2 + \frac{\sqrt{-31}}{2}\right)$.
My question is: have I done this right or did I overlook a factor somewhere?
 A: What you did is right. You found a ring such that there exist different factorizations of a fixed element, and these can differ in the number of factors.
I give you two other examples. In $\mathcal{O}_{\mathbb{Q}(\sqrt{-26})}$ there exists
$$27=3^3 = (1+\sqrt{-26})(1-\sqrt{-26})$$
this is very counterintuitive: it's a cube which is the product of two coprime elements which are not cubes!
Another example is in $\mathcal{O}_{\mathbb{Q}(\sqrt{-29})}$:
$$30 = 2 \cdot 3 \cdot 5 = (1+\sqrt{-29})(1-\sqrt{-29})$$
this element has two distinct factorizations in irreducibles. But the first has three distinct factors, the second has only two.
This could be strange at first sight, however we are inside non-UFDs, so intuition in this case fails.
A: The concept of norms is extremely useful here. Presumably you have read about it and maybe done some exercises pertaining to it.
The relevant norm function here is: $$N\left(\frac{a}{2} + \frac{b \sqrt{-31}}{2}\right) = \frac{a^2}{4} + \frac{31b^2}{4}.$$
Part of what makes the norm function so useful is the fact that it is multiplicative (there's probably a proof of this in one of your books, so I won't rehash it here). For example, $$N(10) = N(2) N(5) = N\left(\frac{3}{2} - \frac{\sqrt{-31}}{2}\right) N\left(\frac{3}{2} + \frac{\sqrt{-31}}{2}\right).$$ So, if $\frac{7}{2} + \frac{\sqrt{-31}}{2}$ is "composite" (which is to say, not irreducible), we should be able to find $m, n \in \mathcal{O}_{\mathbb{Q}(\sqrt{-31})}$ such that $N(m) N(n) = 20$ yet $N(m) \neq 1$, $N(n) \neq 1$.
The possibilities are:


*

*$N(m) = 2$, $N(n) = 10$

*$N(m) = 4$, $N(n) = 5$


(You can switch $m$ and $n$ if you want, but it makes no difference for this argument).
Another fact that really helps us out in this imaginary rings is that the norm is never negative, so we don't have to worry about $N(m) = -2$, for example. But as it turns out, there is no $m$ in this domain such that $N(m) = 2$ either; note that $N(2) = 4$.
Which brings us to the second possibility, the one with $N(n) = 5$. There is no number in this domain with that norm. $N(3) = 9$ and $N\left(\frac{1}{2} + \frac{\sqrt{-31}}{2}\right) = 8$. This means that $\frac{7}{2} + \frac{\sqrt{-31}}{2}$ is irreducible.
In terms of norms, you have found that $400 = 16 \times 25 = 4 \times 10 \times 10 = 20 \times 20$.
I don't know if you have read about class numbers yet. A ring with unique factorization has class number 1 (like $\mathbb{Z}[i]$). A ring like $\mathbb{Z}[\sqrt{-5}]$ has class number 2: you could say that unique factorization "fails a little;" a number can have two distinct factorizations into irreducibles but both factorizations should have the same number of factors.
$\mathcal{O}_{\mathbb{Q}(\sqrt{-31})}$ has class number 3: you could say that unique factorization "fails more" than it does in  a class number 2 ring, and you have found an example of a number with three factorizations where two of the factorizations have three factors each and one factorization has two factors.
