TITLE: Hensel lemma - generalization?
QUESTION [8 upvotes]: Let $f \in \Bbb Z[X]$ be monic and assume that $f$ has a root $a_n$ modulo $p^n$ for every $n \geq 1$ (where $p$ is a fixed prime). Does it follow that $f$ has a root in $\Bbb Z_p$?
The problem is that we might have $f'(a_n) \equiv 0 \pmod p$ so that Hensel's lemma doesn't apply directly. If this is true, what reference/book gives a proof of this fact (stated as above)?

REPLY [8 votes]: Consider $f$ as a map $\mathbb{Z}_p\to\mathbb{Z}_p$.  Since $f$ has a root mod $p^n$ for all $n$, the image of $f$ contains points arbitrarily close to $0$ in the $p$-adic metric.  But $f$ is continuous and $\mathbb{Z}_p$ is a compact Hausdorff space, so the image of $f$ must be closed.  Thus $0$ is in the image of $f$, i.e. $f$ has a root in $\mathbb{Z}_p$.
(If you unwind this proof it's essentially the same as Qiaochu's, but the topological language really makes it very simple!)