Definition for a distance function over a residue class ring

62 Views Asked by At

I'm searching for a reasonable definition of a distance function $$d:\mathbb{Z}/n\mathbb{Z}\times \mathbb{Z}/n\mathbb{Z}\to\mathbb{N}_0$$ which satisfies

  • $d(\overline{n-1},0)=1$
  • $d(\overline{i},\overline{j})=j-i$ for all $0\le i<j<n$

How should I define $d$?

1

There are 1 best solutions below

0
On BEST ANSWER

You could define the magnitude of a number as $$|x|:=\min\{x\bmod n,-x\bmod n\}$$

which gives essentially distance from $0\equiv n$.

Then the distance would just be $$d(i,j)=|i-j|$$ Is that what you are looking for?