Prove that $(\mathbb{Z},d)$ is a metric space I got this from Mendelson:
  Let   $\mathbb {Z}$  be the set of integers.Let $p$ be a positive prime integer. Given distinct integers $m$, $n$ there´s a unique integer $t=t(m,n)$ such that:
$$ m-n=p^tk $$
where $k$ is an integer not divisible by $p$. Define a function $d:\mathbb {Z} \times \mathbb {Z}\rightarrow \mathbb {R}$ by the correspondence
$$d(m,m)=0$$
and
$$d(m,n)=\frac{1}{p^t}$$
from $m \neq n.$
Prove that $(\mathbb {Z,d})$ is a metric space.
I would appreciate a better explanation to this question. I didn´t get the $t(m,n)$. This is also a distance,right?
 A: Let $x, y, z$ be integers.
It suffices to prove that $d(x, z) \leq d(x, y) + d(y, z)$.
If two of $x, y, z$ are equal, this is trivial.
So we can assume they are distinct.
Let $x - y = p^k a$, where $a$ is not divisible by $p$.
Let $y - z = p^s b$, where $b$ is not divisible by $p$.
We can assume $k \leq s$.
Then $x - z = (x - y) + (y - z) = p^k a + p^s b = p^k(a + p^{s-k}b)$.
Suppose $x - z = p^r c$, where $c$ is not divisible by $p$.
Then $r \geq k$.
Hence $d(x, z) = 1/p^r \leq 1/p^k = d(x, y) \leq d(x, y) + d(y, z)$.
And we are done.
A: Don't think of $t(m,n)$ as a distance. Rather, consider the following:
Let $x = m-n$. Then by the fundamental theorem of arithmetic, $x$ has a (unique) prime factorization. Let $p$ be any prime. Then, $p$ has some order, call it $t$ such that $t \ge 0$ (and $t \ge 1$ if $p$ is in the prime factorization of $x$).
So, in other words, $t(m,n)$ yields the order of the prime factor $p$ of the prime factorization of $m-n$. The rest of the work just simply requires you to show that the properties of a metric space hold (or perhaps that they do not).
