Okay, you clearly have d(x,x)= 0 and that d(x,y)> 0 if .

Also clear is that d(x,y)= d(y,x).

The only hard part is the "triangle inequality":

If x= y or z= y or x= z, that is trivial so you can assume they are all different.

I think the crucial part is to note that if divides both x- z and z- y then it also divides x- y= (x- z)+ (z- y).