$p$ adic integers is a metric completion of $\mathbb{Z}$ I have seen in many places that $\mathbb{Z}_p$ is a metric completion of  $\mathbb{Z}$ with respect to the $p$ adic norm. But I'm struggling to see why this is equivalent to the the simple definition of $p$ adic integers
$$
\left\{ \sum_{n \geq 0} a_n p^n : 0 \leq a_n < p \right\}. 
$$
Is there an easy way to see this connection? Thank you!
 A: Suppose $(x_k)$ is a Cauchy sequence in $\mathbb{Z}$ with respect to the $p$-adic metric.  Let $x_k=\sum_n a_{kn}p^n$ be the $p$-adic expansion of $x_k$ (if $x_k$ is positive this is just the usual finite base $p$ expansion, but if $x_k$ is negative it will be an infinite sum).  The condition that $(x_k)$ is Cauchy with respect to the $p$-adic metric means that for any $m$, there exists $N$ such that $x_k-x_l$ is divisible by $p^m$ for all $k,l\geq N$.  In terms of the $p$-adic expansions, this just means that $a_{kn}=a_{ln}$ for all $n<m$ (since the mod $p^m$ residue of $x_k$ is just $\sum_{n<m}a_{kn}p^n$).  So to say that $(x_k)$ is Cauchy means exactly that for each $n$, the sequence $(a_{kn})$ is eventually constant.  Let $a_n$ be the eventually constant value of $a_{kn}$; the idea now is that we can identify the equivalence class $[(x_k)]$ of the Cauchy sequence $(x_k)$ with the formal sum $\sum a_np^n$.  In this way points of the completion of $\mathbb{Z}$ with respect to the $p$-adic metric can be thought of as formal $p$-adic expansions.
(To fully verify this, there are of course more details to check.  You have to check that two Cauchy sequences are equivalent iff they give rise to the same sequence $(a_n)$.  You can then also check that every formal $p$-adic expansion $\sum a_np^n$ arises from some Cauchy sequence in this way (for instance, you can take $a_k=\sum_{n<k}a_np^n$) and that the metric on the completion coincides with the usual $p$-adic metric defined on formal $p$-adic expansions.)
