Metric on the profinite completion of the integers? The p-adic integers come with a metric and associated topology, both of which can be restricted down to the integers.
Does this also apply to the profinite completion of the integers? Do they have either an associated topology or metric, and if so, what does this induce on the integers? What do open sets of integers look like in this topology?
 A: $\newcommand{\Z}{{\mathbb Z}}\newcommand{\N}{{\mathbb N}}$Please excuse that I write many details that can be found elsewhere (many, for example, in the German wikipedia article on profinite integers) and that are not all directly related to the question of a metric. My intention is to present my current understanding of $\hat\Z$. I am obviously not a specialist of topology.
One way of representing $\hat\Z$ is to write its elements as sequences $(r_i+i\Z)_{i\in\N}$, where the sequence $r_i$, $i\in\N$ satisfies the compatibility condition $r_i\equiv r_j \mod j$ whenever $j|i$. The elements of $\Z$ are identified with the constant sequences. As $r_{k!}+k!\,\Z$ determines $r_1,\dots,r_k$, we can also represent $\hat\Z$ as the set of sequences $(s_k+k!\Z)_{k\in\N}$, where $s_{k+1}\equiv s_k\mod k!$ for all $k$. In both representations the topology on $\hat\Z$ is the (restriction of the) product topology of the discrete topologies of the $\Z/i\Z$ or $\Z/k!\Z$, respectively. In the second representation, this means that a base is given by the sets $O_{m,t}=\{(s_k+k!\Z)_{k\in\N}\in\hat\Z\mid s_k\equiv m\mod k!\mbox{ for }k\leq t\}$, $t\in\N$, $m\in\{0,\dots,t!-1\}$. (So the open sets are precisely the unions of any number of sets $O_{m,t}$.) It is well known that a countable product of metric spaces is metrizable. So we define on the discrete spaces $\Z/n\Z$ the trivial metric $d_n(a,b)=0$ or $1$ if $a=b$ or $a\neq b$, respectively, and a metric on $\hat\Z$ in the first representation can be defined as
$$d(s,\tilde s)=\sum_{i\in\N}2^{-i}\frac{d_i(r_i+i\Z,\tilde r_i+i\Z)}
{1+d_i(r_i+i\Z,\tilde r_i+i\Z)}\mbox{ if }s=(r_i+i\Z)_{i\in\N}\mbox{ etc.}$$ Observe also that the product topology is the topology of pointwise convergence; here the convergence in the factors is with repect to the discrete topology.
The second representation shows that every element of $\hat\Z$ can be written uniquely as a formal series $\sum_{k\in\N}a_k\,k!$, where $a_k\in\{0,\dots,k\}$ and that every such formal series represents some element of $\hat\Z$. This shows (as for the real numbers) that $\hat\Z$ is uncountable.
It also suggests to introduce a second metric based  on the second representation:
$d(s,\tilde s)=1/N$ if $s=(s_k+k!\Z)_{k\in\N}$, 
$\tilde s=(\tilde s_k+k!\Z)_{k\in\N}$ and $N\in\N$ is maximal such that $\tilde s_k\equiv s_k$ for $k<N$. If there is no such $N$, i.e. $s=\tilde s$ then we put $d(s,\tilde s)=0$. It is straightforward to verify the axioms of a metric. We even have $d(s,\bar s)\leq \max(d(s,\tilde s),d(\tilde s,\bar s)$. Clearly 
$O_{m,t}=\{s\in\Z\mid d(m.s)\leq 1/t\}$. Therefore the topology of $\hat\Z$ is the one generated by $d$. It is also left to the reader to show that $\hat\Z$ is complete and that $\Z$ is dense in $\hat\Z$ with respect to this metric. By construction, addition in $\hat\Z$ (which is defined componentwise) is continuous. Also the multiplication (again defined componentwise) is continuous since $d(s\tilde s,0)\leq \min(d(s,0),d(\tilde s,0))$. 
Observe that $\hat Z$ contains zero divisors, i.e. $s\tilde s$ can be zero even if both $s$, $\tilde s$ are nonzero. This is best seen in a third representation of $\hat\Z$. It is based on the Chinese remainder theorem which implies that $\Z/n\Z\simeq (\Z/p_1^{n_1}\Z)\times\cdots\times(\Z/p_k^{n_k}\Z)$ if $n=p_1^{n_1}\cdots p_k^{n_k}$ is the prime factor decomposition of $n$. We find that $\hat\Z\simeq\prod_{p\in{\mathcal P}}\Z_p$, where $\mathcal P$ is the set of all primes and, for a prime $p$, $\Z_p$ is that set of all sequences $(u_i+p^i\Z)_{i\in\N}$ where $u_{i+1}\equiv u_i\mod p^i$ for all $i$. These last sets $\Z_p$ are the well known $p$-adic integers. Now consider $s\in\hat\Z$ for which all components are 0 in this third representation except the one for a certain prime $p$ and consider an analogous $\tilde s$ corresponding to some different prime $\tilde p$. Both are not zero, but their product is. 
The topology on $\hat\Z$ corresponds to the product topology of the $p$-adic topologies on $\Z_p$ which are coming from the $p$-adic metric $d_p$ and so a third metric on $\hat\Z$ can be defined by
$$d(s,\tilde s)=\sum_{p\in\mathcal P}2^{-p}\frac{d_p(a_p,\tilde a_p)}
{1+d_p(a_p,\tilde a_p})\mbox{ if }s=(a_p)_{p\in\mathcal P},\tilde s=(\tilde a_p)_{p\in\mathcal P}$$
in the third representation. This is, I think, what Mathmo indicated in his comment. 
Summary: One metric on $\Z$ that leads to $\hat\Z$ is the following:
$$d(m,n)=1/\sup\{N\in\N\mid m\equiv n\mod N!\}.$$
$\hat\Z$ can be seen as the completion of $\Z$ with respect to this metric. This is best seen if the elements of $\hat\Z$ are written as formal series
$$\sum_{k\in\N}a_k\,k!\mbox{ with certain }a_k\in\{0,\dots,k\}.$$
The open sets of $\Z$ in the topology generated by $d$ are those $O\subseteq \Z$ such that for every $m\in O$ there exists a $N$ such that
$O$ contains the set of all $n$ with $n\equiv m\mod N!$. 
A: User Helmut makes good points in his answer. I just want to stress that


*

*The topology on $\Bbb Z$ with respect to which $\hat{\Bbb Z}$ is the completion can be described as follows: $x \in \Bbb Z$ has as basis of open neighbourhoods $(x + n \Bbb Z)_{n \in \Bbb N}$. In other words, a subset of $\Bbb Z$ is open iff together with each element $x$ in it, it contains some arithmetic progression containing $x$ (i.e. for some $n$, all $x+n\Bbb Z$); or in yet other words, a subset of $\Bbb Z$ is open iff it is a union of arithmetic progressions. Two integers $x, y$ are "close" to each other if (corrected, thanks Helmut:) $x-y$ has "many" prime divisors (with "high" exponents), or in other words, if there are "many" arithmetic progressions which contain both $x$ and $y$. E.g. $360$ is closer to $0$ than most numbers around it; and in the first $10'000$, no number comes closer to $5053$ than $13$.
(NB 1: This is not strictly true for any metric which induces the topology, see below. NB 2: This describes the subspace topology on $\Bbb Z$ induced from the one on $\hat{\Bbb Z}$. The aforementioned sets are not open when viewed as subsets of $\hat{\Bbb Z}$; just like $a+p^{17}\Bbb Z$ is open in $\Bbb Z$ with the $p$-adic topology, but not in $\Bbb Z_p$.)

*There are many metrics which induce this topology, but none of them is given by a ring norm (different from the $p$-adic setting).

*Since on integers, the $p$-adic metrics $d_p(x,y) := \lvert x-y\rvert_p$ are already bounded by $1$, we don't need the extra construction in Helmut's "third metric", and e.g.

$$d(x,y) := \displaystyle\sum_{p \text{ prime}} \dfrac{d_p(x,y)}{2^{n(p)}}$$

where $p$ is the $n(p)$-th prime, is a kind of "visualisable" metric which induces the topology. $x$ and $y$ are close to each other if they are close $p$-adically for many $p$. A sequence $x_n$ converges to $x$ iff $\lim_{n\to \infty} \lvert x_n-x\rvert_p =0$ for all prime $p$.


*

*Note however that the metric has a lot of leeway. I think one could do something like 


$$d(x,y) := \displaystyle\sum_{p \text{ prime}} w_p \cdot d_p(x,y)$$

where $w_p$ (the weight for the $p$-adic metric) just has to satisfy $\sum_p w_p < \infty$. (Compare Show that the countable product of metric spaces is metrizable.) So if we set $w_p = 2^{-100}$ for $p=2,3,5,7$ but $w_{11} = 1$, and $w_p = 2^{-n(p)}$ for all other primes as before, then contrary to what I said in my first point, $5042$ is closer to $5053$ than $13$ is, because I made this metric so that it puts a lot of weight on the difference being divisible by $11$. The topology alone does not really define "closeness". What is important in the end is that all $p$-adic differences "weigh in".
