Describe all prime and maximal ideals of $\mathbb{Z}_n$ I know that an ideal P in $\mathbb{Z}_n$ is prime if and only if $\mathbb{Z}_n/P$ is an integral domain and an ideal m in $\mathbb{Z}_n$ is maximal if and only if $\mathbb{Z}_n$/m is a field. 
I think I've figured out that $\mathbb{Z}_p$ where p is a prime that divides n make up the maximal ideals.
I have no idea how to figure out which are prime.  Help?

Consider the canoncial map $$\pi:\Bbb Z\rightarrow \Bbb Z_n$$ If $\mathfrak m\subset\Bbb Z_n$ is a maximal ideal, then $\pi^{-1}(\mathfrak m)\subset\Bbb Z$ is maximal aswell. This means that $\pi^{-1}(\mathfrak m)=(p)$ for some prime $p\in\Bbb Z$. There are two cases to consider:

*

*If $p\mid n$ then $(p)$ is a maximal ideal of $\Bbb Z_n$, since $$\Bbb Z_n/(p)\equiv\Bbb Z_p$$


*If $p\not\mid n$ then $p$ is a unit in the ring $\Bbb Z_n$, so $(p)\cong \Bbb Z_n$
