TITLE: How to find all the maximal ideals of $\mathbb Z_n?$
QUESTION [17 upvotes]: How to find all the maximal ideals of $\mathbb Z_n?$

I think $(0)$ is the only maximal ideal of $\mathbb Z_n$ for if $a$ is a non-unit in a maximal ideal of $\mathbb Z_n$ then $(a,n)=1\implies\exists~u,v\in\mathbb Z$ such that $au+nv=1\implies au=1~(\equiv\mod n)\implies 1\in$ the maximal ideal !
Am I right?

REPLY [2 votes]: The ring $\mathbb Z_p$ is a principal ideal domain: its ideals are $\{0\}$ and $p^k \mathbb Z_p$ ($k \in \mathbb N$).
Proof. Let $I \neq \{0\}$ be a nonzero ideal of $\mathbb Z_p$ and $0 \neq a \in I$ an element of minimal order, say $v(a) = k$. Write $a = p^k u$ with $p$-adic unit $u$. Hence $p^k = u^{-1} a \in I$ and $(p^k) \subseteq I$. Conversely, for any $b \in I$ let $w(b) \ge k$ and write $$b = p^w u' = p^k p^{w-k} u' \in p^k \mathbb Z_p.$$ This shows that $I \subseteq p^k\mathbb Z_p$. $\mathbb Z_p$ is a local ring, its maximal ideal is $p\mathbb Z_p$.
Unless you meant $\mathbb Z/n\mathbb Z$ and not the ring of $p$-adic numbers...