In Murty and Esmonde's Problems in Algebraic Number Theory, a proof of the following theorem is given.
Let $K$ be a finite degree extension of $\mathbb{Q}$, and $\mathcal{O}_K = \mathbb{Z}[\theta]$ for some $\theta \in K$. If $f(x) \in \mathbb{Z}[x] $ is the minimal polynomial of $\theta$ and $$f(x) \equiv f_1(x)^{e_1} \cdots f_g(x)^{e_g} \mod{p}$$ for a prime $p \in \mathbb{Z}$. Then we have $$ (p) = p\mathcal{O}_K = \prod_{i=1}^g P_i,$$ where $P_i = (p, f_i(\theta)) $ are prime ideals.
In the proof, they show the $P_i$ are prime ideals by showing $P_i = \ker(\phi)$, where $\phi \colon \mathbb{Z}[x] \to \mathbb{Z}[\theta]/(p, f_i(\theta))$ is the evaluation homomorphism. $P_i \subseteq \ker(\phi)$ is clear, but they claim that for any $n(x) \in \ker(\phi)$, we can divide by $f_i(x)$ to write $$n(x) = q(x)f_i(x) + r_i(x), \quad \deg(r_i) < \deg(f_i)$$ (and use some other arguments to show this implies $\ker(\phi) \subseteq P_i$). My question is, how can we be sure we can write $n(x)$ in this way? It seems like the authors are claiming that $\mathbb{Z}[x]$ is an Euclidean domain, which is not true. Also, it is not clear why $\deg(r_i) < \deg(f_i)$ is important.