Profinite completion of integers, $\hat{\mathbb{Z}}$, is isomorphic to the product over primes of the $p$-adic integers $\mathbb{Z}_p$ I've been trying to show that the profinite completion of the integers, $\hat{\mathbb{Z}}$ is isomorphic to the product over $p$ of the $p$-adic integers. But I'm kind of stuck. Here is what I got so far.
By the Chinese Remainder Theorem we have $$\mathbb{Z}/n\mathbb{Z}\simeq \underset{p}\prod \mathbb{Z}/p^{v_p(n)}\mathbb{Z}$$ hence $$\underset{n}\varprojlim\ \mathbb{Z}/n\mathbb{Z}\simeq \underset{n}\varprojlim\underset{p}\prod\mathbb{Z}/p^{v_p(n)}\mathbb{Z}$$ where the inverse limit on the right is taken with respect to the projections, for $m|n$:$$\underset{p}\prod\mathbb{Z}/p^{v_p(n)}\mathbb{Z}\overset{\sim}\longrightarrow\mathbb{Z}/n\mathbb{Z}\longrightarrow\mathbb{Z}/m\mathbb{Z}\overset{\sim}\longrightarrow\underset{p}\prod\mathbb{Z}/p^{v_p(m)}\mathbb{Z}$$ $$(x_p+p^{v_p(n)}\mathbb{Z})_p\mapsto x+n\mathbb{Z}\mapsto x+m\mathbb{Z}\mapsto (x+p^{v_p(m)}\mathbb{Z})_p$$ where $x+n\mathbb{Z}$ is the unique element in $\mathbb{Z}/n\mathbb{Z}$ such that $x+p^{v_p(n)}\mathbb{Z}=x_p+p^{v_p(n)}\mathbb{Z}$. We now define the map $$\underset{n}\varprojlim\underset{p}\prod\mathbb{Z}/p^{v_p(n)}\mathbb{Z}\longrightarrow \underset{p}\prod\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\ ,\ \{(x_{n,p}+p^{v_p(n)}\mathbb{Z})_p\}_n\mapsto(\{x_{m,p}+p^{v_p(m)}\mathbb{Z}\}_m)_p$$Where inverse limit on the right is taken with repsect to projections, for $k|m$, $\mathbb{Z}/p^{v_p(m)}\mathbb{Z}\longrightarrow\mathbb{Z}/p^{v_p(k)}\mathbb{Z}$ . The map clearly does not depend on coset representatives and after messing around for a bit we can show that indeed for fixed $p$, $\{x_{m,p}+p^{v_p(m)}\mathbb{Z}\}_m$ is an element of $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$. Hence the map is well defined and it's clearly a bijective ring homomorphism hence an isomorphism.
Now it remains to show that for fixed $p$ we have $$\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\simeq\underset{m}\varprojlim\ \mathbb{Z}/p^m\mathbb{Z}$$ This is where I am having problems. The orderings on $m$ are not compatible and I haven't been able to construct a well defined map so far. I also thought of constructing a chain of isomorphisms $$\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\simeq\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m!)}\mathbb{Z}\simeq\underset{m}\varprojlim\ \mathbb{Z}/p^m\mathbb{Z}$$ to try and make the orderings on $m$ align a bit better but haven't had any luck in defining suitable maps. Note that I am not looking for categorical proofs regarding the isomorphism in question. I've already been through some of those. I am looking for hints on construcing explicit maps
Edit after Eric Wofsey's response: We define the ring homomorphism$$\theta:\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\longrightarrow\underset{r}\varprojlim\ \mathbb{Z}/p^r\mathbb{Z}\ ,\ (x_m+p^{v_p(m)}\mathbb{Z})_m\mapsto (x_{p^r}+p^r\mathbb{Z})_r$$ This is well defined by construction since $p^r|p^{r+1}$ hence by the inverse system of $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ we have that $x_{p^{r+1}}+(p^{v_p(p^r)}=p^r)\mathbb{Z}=x_{p^r}+(p^{v_p(p^r)}=p^r)\mathbb{Z}$ which is exactly what is required for $(x_{p^r}+p^r\mathbb{Z})_r$ to be an element of $\underset{r}\varprojlim\ \mathbb{Z}/p^r\mathbb{Z}$. Now let $x:=(x_m+p^{v_p(m)}\mathbb{Z})_m\in ker(\theta)$ then $x_{p^r}\in p^r\mathbb{Z}, \forall r\geq 1$. Now if $p\nmid m$, $v_p(m)=0$ hence $x_m\in p^{v_p(m)}\mathbb{Z}=\mathbb{Z}$. If $p|m$ then $v_p(m)=r$ for some $r\geq1$. Then since $p^r|m$ we have by the inverse system of $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ that $x_m+p^{v_p(p^r)}\mathbb{Z}=x_{p^r}+p^{v_p(p^r)}\mathbb{Z}=0+p^r\mathbb{Z}$ Hence $x_m\in p^r\mathbb{Z}=p^{v_p(m)}\mathbb{Z}$. Hence $x=0$ in $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$, hence $\theta$ injects.
Now given an element $y:=(y_r+p^r\mathbb{Z})_r\in\underset{r}\varprojlim\ \mathbb{Z}/p^r\mathbb{Z}$, we consider the element $x:=(x_m+p^{v_p(m)}\mathbb{Z})_m\in\underset{m}\prod\mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ where $$x_m:=y_{v_p(m)},\ \text{if}\ v_p(m)\geq 1$$ $$x_m:=0,\ \text{if}\ v_p(m)=0$$ Now take $n|m$ then if $p\nmid n$ we have that $x_m+p^{v_p(n)}\mathbb{Z}=x_m+\mathbb{Z}=0+\mathbb{Z}=x_n+p^{v_p(n)}\mathbb{Z}$. So assume $p|n$ hence $p|m$ which implies that $x_m=y_{v_p(m)}\ ,\ x_n=y_{v_p(n)}$. Then by the inverse system of $\underset{r}\varprojlim\ \mathbb{Z}/p^r\mathbb{Z}$ we have that $x_m+p^{v_p(n)}\mathbb{Z}=y_{v_p(m)}+p^{v_p(n)}\mathbb{Z}=y_{v_p(n)}+p^{v_p(n)}\mathbb{Z}=x_n+p^{v_p(n)}\mathbb{Z}$ Hence indeed we have that the element $x$ belongs in $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ and furthermore, it maps to $y$ under $\theta$. Hence $\theta$ also surjects and we have an isomorphism. So overall we have shown that $$\hat{\mathbb{Z}}=\underset{n}\varprojlim\ \mathbb{Z}/n\mathbb{Z}\overset{\sim}\longrightarrow\underset{n}\varprojlim\ \underset{p}\prod\mathbb{Z}/p^{v_p(n)}\mathbb{Z}\overset{\sim}\longrightarrow\underset{p}\prod\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\overset{\sim}\longrightarrow\underset{p}\prod\underset{r}\varprojlim\ \mathbb{Z}/p^r\mathbb{Z}=\underset{p}\prod\mathbb{Z}_p$$ $$\{x_n+n\mathbb{Z}\}_n\mapsto \{(x_n+p^{v_p(n)}\mathbb{Z})_p\}_n\mapsto (\{x_m+p^{v_p(m)}\mathbb{Z}\}_m)_p\mapsto (\{x_{p^r}+p^r\mathbb{Z}\}_r)_p$$
Hence we end up with the isomorphism $$\hat{\mathbb{Z}}\overset{\sim}\longrightarrow\underset{p}\prod\mathbb{Z}_p$$ $$\{x_n+n\mathbb{Z}\}_n\mapsto (\{x_{p^r}+p^r\mathbb{Z}\}_r)_p$$
 A: I think you may be getting yourself confused by using the same index variable $m$ on both sides.  As you say, these $m$'s are given two totally different orderings, so you shouldn't think of them as corresponding.  So let's call one of them $n$, so we're looking for an isomorphism $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\simeq\underset{n}\varprojlim\ \mathbb{Z}/p^n\mathbb{Z}$.
Now there's an obvious way you might try to get a map between these: just have the terms $\mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ where $v_p(m)=n$ correspond to the term $\mathbb{Z}/p^n\mathbb{Z}$.   For instance, if you restrict $m$ to just take values in the powers of $p$, you get that the inverse system of $\mathbb{Z}/p^n\mathbb{Z}$'s is a subsystem of the inverse system of $\mathbb{Z}/p^{v_p(m)}\mathbb{Z}$'s.  This gives you a projection map $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}\to\underset{n}\varprojlim\ \mathbb{Z}/p^n\mathbb{Z}$ which just omits all the coordinates corresponding to values of $m$ which are not powers of $p$.  Now you just have to check that this map really is an isomorphism.  This amounts to checking that an element of $\underset{m}\varprojlim\ \mathbb{Z}/p^{v_p(m)}\mathbb{Z}$ is uniquely determined by its values on coordinates where $m$ is a power of $p$ (so the map is injective), and that if you choose those values in a compatible way you can always extend to all other values of $m$ in a compatible way (so the map is surjective).
