2-adic absolute value (source code)

= 2-adic absolute value
{title2=$|x|_2=2^{-v_2(x)}$}

The 2-adic absolute value is the <p-adic absolute value> for the <prime number> $p=2$. It is defined on the <rational numbers> by $|x|_2=2^{-v_2(x)}$ for $x\ne0$ and $|0|_2=0$, and extends to their <P-adic number> completion $\mathbb Q_2$. For a nonzero <integer>, count factors of two until the remaining factor is odd; for a <rational number>, subtract the <denominator>'s count from the <numerator>'s count.

The associated <metric> reverses a familiar comparison:
$$
d_2(5,13)=|5-13|_2=|-8|_2=\frac18,\qquad d_2(5,6)=|-1|_2=1.
$$
Although $13$ is eight units from $5$ on the ordinary <number line>, it agrees with $5$ modulo $8$, whereas $6$ already disagrees modulo $2$. The <2-adic absolute value> measures that agreement. The value $|3/8|_2=8$ also shows why this <Non-Archimedean absolute value> must be distinguished from the ordinary <absolute value> $|3/8|=3/8$.

\Image[/two-adic-distance-comparison.png]
{title=Ordinary <absolute value> and <2-adic absolute value> give different distance patterns for the same sixteen <integers>}

In the left panel, differences farther from the diagonal grow in ordinary <absolute value>. In the right panel, nonzero even differences are closer than odd differences, and each further factor of two halves the <2-adic absolute value>. The highlighted pairs have opposite distance rankings. The repeated pattern is the nested <congruence class> structure of an <ultrametric space>, visible without adding any new points.