Why are $p$-adic numbers formal series? Let $p$ be a prime number and set 
$$\mathbf{Z}_p = \varprojlim_n \mathbb{Z}/(p)^n$$

Why can every element in $\mathbb{Z}_p$ be represented as a formal power series $\sum_{k=0}^{\infty}a_k p^k$ where $0 \leq a_k < p$?

So I thought I could do the trick as with the ring $R[[x]]$ and the completion $\widehat{R}^{(x)} = \varprojlim_n R[x]/(x)^n$. Let $S = \left\{ \sum_{k=0}^{\infty}a_ip^i \colon 0 \leq a_i < p \right\}$ and define an homomorphism
\begin{align*}
\varphi \colon  S &\to \mathbb{Z}_p\\
f & \mapsto \left( f + (p)^n\right)_n
\end{align*}
The inverse map would be the one sending each sequence $\left( f_n + (p)^n \right)_n$ to the element $f_0 + (f_1 - f_0) + (f_2 - f_1) + \cdots$, but I can't prove that this element is in $S$. 
Each summand $f_{i+1} - f_i$ is divisible by $p^i$ and hence we could write $f_{i+1} - f_i = a_i p^i$, but I don't quite get why the $a_i < p$ for each $i$. 
 A: That is because of how the inverse limit is defined: an element in $\mathbf Z_p$ is a sequence of congruence classes
$$x=(x_n\bmod p^n)_{n\ge 1}\quad\text{s. t. } \;\forall n,\;x_{n+1}\equiv x_n\mod p^n. $$
Initially, $x_1\in\mathbf Z/p\mathbf Z$ is represented by an integer in $[0,p)$, and  from these relations, it is easy to deduce by induction that for all $n$, $x_n$ can be written as $\;a_0+a_1p+\dots+a_{n-1}p^{n-1}$, where $\;0\le a_i<p$ for each i.
A: By definition an element of an inverse limit (say, of groups) is a choice of one element in each group that is compatible with the system of maps - that is, if you chose element $a\in C_A$ and element $b\in C_B$ and if there is an arrow $C_A\to C_B$ in your system, then $b$ needs to be the image of $a$ by that arrow.
This means that one element of $\varprojlim_n \mathbb{Z}/(p)^n$ is actually a collection of residues modulo each power of $p$.
Now consider $x\in\varprojlim_n \mathbb{Z}/(p)^n$. For each $k$, there is a corresponding element $x_k\in \mathbb{Z}/(p)^k$. Consider the unique non-negative integer representative of $x_k$ that is less than $p^k$, and write it in base $p$.
This gives you $$x_k=[a_0p^0+\ldots+a_{k-1}p^{k-1}]$$


*

*By definition of base $p$, the $a_i$'s satisfy $0\leq a_i<p$

*A priori it looks like the $a_i$'s depend on $k$, but by compatibility the $x_n$'s are residues of each other, which means that the $a_i$'s actually only depend on $x$.
Altogether, the datum of $x$ is equivalent to the datum of the sequence $(x_k)_{k\in \Bbb N}$ which in turn is equivalent to the datum of the sequence $a$ - the entries of which are naturally thought of as coefficients in a power series.
