On this wikipedia page: https://en.wikipedia.org/wiki/Profinite_integer, we find the equation $$\widehat{\mathbb{Z}} = \prod_p \mathbb{Z}_p$$ which says that the profinite completion of the integers equals the product over the various primes of the $p$-adic integers $\mathbb{Z}_p$. Now, I just started reading up on this stuff, but this strikes me as a very strange thing. I would expect to have $\widehat{\mathbb{Z}} \subseteq \prod_p \mathbb{Z}_p$, but not equality. Why am I confused? Well, the definition $$\widehat{\mathbb{Z}} = \lim_\leftarrow \mathbb{Z} /{n\mathbb{Z}}$$ makes me want to think of $\widehat{\mathbb{Z}}$ as a sort of overgroup of all the $\mathbb{Z}/n\mathbb{Z}$, a sort of largest group of formal integers which still manage to have well-defined remainders modulo every integer $n$.
On the other hand, each $\mathbb{Z}_p$ contains a copy of $\mathbb{Z}$ and so, from the equation at the top, we have a copy of $\prod_p \mathbb{Z} \subseteq \widehat{\mathbb{Z}}$. This seems strange. Given a list of integers $x = (x_p) \in \prod_p \mathbb{Z}$, how do I go about extracting the remainders of $x$ modulo various integers?
To ask a more concrete question, consider the element $x = (x_p) \in \prod_p \mathbb{Z} \subseteq \widehat{\mathbb{Z}}$ with $x_2 = m \in \mathbb{Z} \subseteq \mathbb{Z}_2$ and $x_3 = n \in \mathbb{Z} \subseteq \mathbb{Z}_3$ and $x_p =0$ for $p \neq 2,3$. What is the remainder of $x$ in $\mathbb{Z}/6\mathbb{Z}$? Presumably something constructible in terms of $m$ and $n$?
The remainder of your $x$ in the last paragraph modulo $6$ is the unique residue modulo $6$ solving $x\equiv m\pmod 2$ and $x\equiv n\pmod 3$.
In general let $n=p_1^{k_1}\cdots p_r^{k_r}$. Then the remainder of $x=(x_p)$ modulo $n$ is the simultaneous solution of $x\equiv x_{p_j}\pmod{p_j^{k_j}}$ for $j=1,\ldots,r$ (by the Chinese Remainder Theorem).