Metric space in Topology class On the set of integers $\mathbb Z$, show that the function d, defined as follow, is a metric : $$ d(x,y) = \begin{cases} 0 & \text{if } x=y \\
 \min\{1/n! \mid n! \text{ divides } |x-y|\} & \text{if } x\neq y \end{cases}$$
metric space axiom.


*

*$d(x,y) \geq 0 \quad \forall(x,y) \in X\times X$

*$d(x,y)=0 \iff x=y$

*$d(x,y)=d(y,x) \forall x,y \in X$

*$d(x,y)+d(y,z) \geq d(x,z) \quad \forall x,y,z\in X$


I have a difficulty proving 4th axiom. I don't know how to start. Is there someone to help?
 A: First note that $a$ divides $b-c$ iff it divides $c-b$, so that the absolute value sign in the condition $n!$ divides $|x-y|$ may be dropped and the condition can be written as $n!|x-y$ (where this single $|$ is the symbol for "divides").
Now for each pair of distinct integers $x,y$ let $n_{xy}$ denote the largest $n$ such that $n!|x-y.$ Then $d(x,y)=1/n_{xy}!.$ Since $d$ is nonnegative and $d(x,x)=0$ the triangle inequality is clear if any two of $x,y,z$ are equal, so we assume they are distinct.
To look at $d(x,y)+d(y,z)$ we note that if $w=\min(n_{xy},n_{yz})$ then $w!$ divides $x-z=(x-y)+(y-z).$ It may happen that a larger factorial than $w!$ divides $x-z$, but we do have $w \le n_{xz}$ in any case. So we have
$$d(x,z)=1/n_{xz}! \le 1/w! \le 1/n_{xy}!+1/n_{yz}!=d(x,y)+d(y,z).$$
 (In the second inequality, since $w$ is the smaller of the two of $n_{xy},n_{y,z}$ its reciprocal factorial is the reciprocal factorial of one of them, so is less than their sum.) This actually shows the slightly stronger inequality $d(x,z) \le \min [d(x,y),d(y,z)],$ reminiscent of a $p$ adic norm.
