Example of a function from $\Bbb Z$ to $\Bbb Z$ continuous but not uniformly continuous for the $p$-adic metric. Let $p$ be a prime number. The $p$-adic valuation of an integer $n$ is the exponent of the highest power of $p$ that divides $n$. It is denoted $\nu_p(n)$. The $p$-adic metric $d_p$ on $\Bbb Z$ is defined  by
$$
d_p(x,y) = p^{-\nu_p(|x-y|)}
$$
It is easy to find examples of functions from $\Bbb N$ to $\Bbb N$ that are continuous but not uniformly continuous for $d_p$, but I am looking for a function from $\mathbb Z$ to $\mathbb Z$ that is continuous but not uniformly continuous for $d_p$. Is there an easy example?
 A: The $p$-adic valuation $\nu_p(\cdot)$, seen as map from $\mathbb Z_p \setminus\{0\}$ to $\mathbb Z$, is locally constant away from $0$, but has a non-removable discontinuity at $0$ (if we endow both domain and codomain with the $p$-adic metric). We can exploit that as follows:
Take any $z \in \mathbb Z_p \setminus \mathbb Z$, and consider $f: \mathbb Z \rightarrow \mathbb Z$ defined by $f(x) := \nu_p(x-z)$.
Then $f$ is locally constant, in particular continuous. But if $(x_n)_n$ is a sequence in $\mathbb Z$ such that $\nu_p(x_n-z) = n$ (such sequences exist by well-known properties of $p$-adics), then we have $\lvert x_{n+1} -x_{n} \rvert_p \le p^{-n}$, but $\lvert f(x_{n+1}) - f(x_{n})\rvert_p = \lvert n+1-n \rvert_p =1$. In particular, for any $0 < \varepsilon <  1$ we will not find a $\delta$ as needed for uniform continuity, because we can always find $n$ with $\lvert x_{n+1}-x_n\rvert_p < \delta$.
By the way, my original idea, from this answer, was to take an integer $r \ge 2$ such that $\frac{1}{r} \in \mathbb Z_p$ (e.g. for all odd $p$, take $r=2$), and consider $f: x \mapsto \nu_p(rx-1)$. This is just the special case $z =1/r$.
