How to factor polynomials in $\mathbb{Z}_n$?
let $ f $ be a irreducible polynomial over finite field $\Bbb{F}_q$ and $ \alpha$ is a zero of $f$. let $ d=\mathrm{deg}(f)$. then degree of $\Bbb{F}_q(\alpha)$ is $d$ and the zero is also zero of $ x^{q^d}-x$. therefore all irreducible polynomial with degree $d$ is factor of $x^{q^d}-x$. If $f$ is not a factor of $x^{q^d}-x$, then $f$ is reducible.