Solution (source code)

= Solution

The <height of an ideal>[height] of a prime ideal $P$ is
$$
\operatorname{ht}P=\sup\{n:P_0\subsetneq P_1\subsetneq\cdots\subsetneq P_n=P
\text{ are prime}\}.
$$

The <Krull principal ideal theorem> states that if $R$ is Noetherian and $P$ is minimal among the primes containing a proper principal ideal $(a)$, then
$$
\boxed{\operatorname{ht}P\leq1.}
$$
Suppose otherwise that $P_0\subsetneq Q\subsetneq P$. Quotient by $P_0$ and localize at $P$; it is enough to consider a Noetherian local domain whose maximal ideal $P$ is the only prime containing $(a)$ and which has $0\subsetneq Q\subsetneq P$.

For $n\geq1$, put
$$
Q^{(n)}=Q^nR_Q\cap R.
$$
This is a $Q$-primary ideal. Since $R/(a)$ is a zero-dimensional <Noetherian ring>, it is <Artinian>, and the descending chain $(Q^{(n)}+(a))/(a)$ eventually stabilizes. Thus, for all sufficiently large $n$, every $q_n\in Q^{(n)}$ can be written
$$
q_n=q_{n+1}+ra,\qquad q_{n+1}\in Q^{(n+1)}.
$$
Now $ra\in Q^{(n)}$, while $a\notin Q$; $Q$-primaryness gives $r\in Q^{(n)}$. Hence
$$
Q^{(n)}=Q^{(n+1)}+aQ^{(n)}.
$$
The <Nakayama lemma> applied to $Q^{(n)}/Q^{(n+1)}$ gives $Q^{(n)}=Q^{(n+1)}$. Localizing at $Q$ makes all sufficiently large powers of the nonzero maximal ideal $QR_Q$ equal. A nonzero element of the stable power then belongs to $\bigcap_nQ^nR_Q$, contradicting the <Krull intersection theorem>. This proves the theorem.

Now let $R$ be a Noetherian <integral domain>. If $R$ is a <unique factorization domain> and $P$ has height one, choose $0\ne x\in P$ and an irreducible factor $p$ of $x$. In a UFD, $p$ is prime, so
$$
(0)\subsetneq(p)\subseteq P.
$$
Height one forces $P=(p)$.

Conversely, suppose every height-one prime is principal. Noetherianity makes $R$ an <atomic domain>. Given an <irreducible element> $p$, choose a prime $P$ minimal over $(p)$. The principal ideal theorem gives $\operatorname{ht}P=1$, so $P=(q)$ by hypothesis. Since $p=qr$ and $p$ is irreducible, $r$ is a unit; hence $(p)=P$ is prime. Thus every irreducible is a <prime element>, and an atomic domain with this property is a UFD. Therefore
$$
\boxed{R\text{ is a UFD}\quad\Longleftrightarrow\quad
\text{every height-one prime of }R\text{ is principal}.}
$$