Solution (source code)

= Solution

Since $\mathcal O=\mathbb Z[\theta]$, reduction gives $\mathcal O/p\mathcal O\cong\mathbb F_p[X]/(\bar g)$. The maximal ideals of this quotient are precisely those generated by the distinct irreducible factors $\bar g_i$. Their inverse images are therefore
$$
\boxed{\mathfrak p_i=(p,g_i(\theta)),}
$$
the distinct <prime ideals> above $p$. In fact $\mathcal O/\mathfrak p_i\cong\mathbb F_p[X]/(\bar g_i)$ is a field of size $p^{\deg\bar g_i}$. Every prime containing $p$ arises this way; independence of the choice of lift $g_i$ follows because another lift differs by a multiple of $p$.

To prove the ideal factorization, set $J=\prod_i\mathfrak p_i^{e_i}$. A generator of the product either contains a factor $p$, and hence lies in $p\mathcal O$, or is the product $\prod_i g_i(\theta)^{e_i}$. The latter also lies in $p\mathcal O$, since its <polynomial> reduces to $\bar g$ and $g(\theta)=0$. Thus $J\subset p\mathcal O$. The <ideal norm> is multiplicative for nonzero ideals in the <ring of integers>; hence
$$
N(J)=\prod_i p^{e_i\deg\bar g_i}=p^{\deg g}
=N(p\mathcal O).
$$
Equal finite indices together with the containment imply equality. Therefore
$$
\boxed{p\mathcal O=\prod_i\mathfrak p_i^{e_i}.}
$$
This proves the <Dedekind factorization theorem> in the stated monogenic case by containment and norms, rather than assuming the desired factorization.