This is the statement of the mod $p$ irreducibility theorem:
Let $p$ be a prime and suppose that $f(x) \in \Bbb Z[x]$ with $\deg f(x) \ge 1$. Let $\bar f(x)$ be the polynomial in $\Bbb Z_p[x]$ obtained from $f(x)$ by reducing all the coefficients of $f(x)$ modulo $p$. If $\bar f(x)$ is irreducible over $\Bbb Z_p$ and $\deg f (x) = \deg \bar f(x)$, then $f(x)$ is irreducible over $\Bbb Q$.
The standard proof I've seen in countless places is as follows:
If $f(x)$ is reducible over $\Bbb Q$, then $f(x) = g(x)h(x)$ with $g(x), h(x) \in \Bbb Z[x]$, and both $g(x)$ and $h(x)$ have degree less than that of $f(x)$. Let $\bar f(x),\bar g(x)$, and $\bar h(x)$ be the polynomials obtained from $f(x), g(x)$, and $h(x)$ by reducing all the coefficients modulo $p$. Since $\deg f(x) = \deg \bar f(x)$, we have $\deg \bar g(x) \le \deg g(x) \lt \deg\bar f(x)$ and $\deg \bar h(x) \le \deg h(x) \lt \deg \bar f(x)$. But $\bar f(x) = \bar g(x)\bar h(x)$, and this contradicts our assumption that $\bar f(x)$ is irreducible over $\Bbb Z_p$.
My question is, why is it necessary that $p$ is prime in this proof? All of the above reasoning seems to remain valid even if $f(x)$ is reduced under modulo $n$, where $n$ is composite?
Thanks.