Solution (source code)

= Solution

Write $R=\mathcal O_K$. We prove <unique factorization of ideals in a number field>, rather than assuming this conclusion as a property of a <Dedekind domain>. Three preliminary facts about $R$ will be useful. Its <additive group> is a finite-rank <free abelian group>, so every <ideal> is finitely generated and the <ascending chain condition> holds. It is an <integrally closed domain>, by <integral dependence is transitive>. Finally, every nonzero <prime ideal> is a <maximal ideal>. For this last fact, choose $0\ne a\in P$. Multiplication by $a$ is an injective endomorphism of the finite-rank <free abelian group> $R$ with nonzero <determinant>, so $R/(a)$ is finite. Consequently $R/P$ is a finite <integral domain> and hence a <field>.

First, every nonzero proper <ideal> contains a product of nonzero <prime ideals>. Otherwise choose a maximal counterexample $J$ under inclusion, using the <ascending chain condition>. It cannot be a <prime ideal>. Choose $x,y\notin J$ with $xy\in J$. The strictly larger <ideals> $J+(x)$ and $J+(y)$ each contain a product of nonzero <prime ideals>, allowing the empty product $R$ when necessary. Multiplying those products gives a product contained in
$$
(J+(x))(J+(y))\subseteq J,
$$
a contradiction.

Next fix a nonzero <prime ideal> $P$, choose $0\ne a\in P$, and choose a product of nonzero <prime ideals>
$$
P_1\cdots P_r\subseteq(a)
$$
with $r$ minimal. Because $(a)\subseteq P$, primality and maximality imply $P_j=P$ for some $j$; reorder so that $P_1=P$. Minimality provides $b\in P_2\cdots P_r$ with $b\notin(a)$, taking the remaining product to be $R$ if $r=1$. Thus
$$
x=b/a\notin R,\qquad xP\subseteq R.
$$
Define the <fractional ideal>
$$
P^{-1}=\{z\in K:zP\subseteq R\}.
$$
It contains $R$ and $x$. The <ideal> $PP^{-1}$ lies between $P$ and $R$, so it is $P$ or $R$. If it were $P$, then $xP\subseteq P$. Applying the <determinant trick> to a finite <generating set of an ideal> for $P$ gives a <monic polynomial> over $R$ satisfied by $x$. Since $R$ is an <integrally closed domain>, this would put $x$ in $R$, a contradiction. Therefore
$$
\boxed{PP^{-1}=R}.
$$
This proves that each nonzero <prime ideal> is an <invertible fractional ideal>, independently of the desired factorization theorem.

Now take a nonzero proper <ideal> $A$ and a <maximal ideal> $P$ containing it. The <ideal> $B=P^{-1}A$ satisfies
$$
A\subseteq B\subseteq R,\qquad A=PB.
$$
The first inclusion is strict: if $A=B$, the same $x\in P^{-1}\setminus R$ would stabilize $A$, and the <determinant trick> would again force $x\in R$. Repeating gives a strictly ascending chain until it reaches $R$; the <ascending chain condition> ensures this happens after finitely many steps. The identities $A=PB$ then express $A$ as a product of nonzero <prime ideals>.

For uniqueness, suppose $P_1\cdots P_r=Q_1\cdots Q_s$. Since the right-hand side is contained in $P_1$, some $Q_j$ is contained in $P_1$. Both are nonzero <maximal ideals>, so $Q_j=P_1$. Multiplication by $P_1^{-1}$ cancels this factor. Repeat. A nonempty product of proper <prime ideals> cannot equal $R$, so both products finish together. This proves uniqueness up to reordering, including repeated factors.