A metric on the multiplicative structure of integers. Two numbers are "close" if their prime factorizations differ by little — regardless of how far apart they are on the number line.
Each cell shows d(i, j). Notice how additively adjacent numbers (like 8 and 9) can be multiplicatively distant, while multiplicatively related numbers cluster.
The usual distance between integers — |a - b| — measures how far apart they sit on the number line. But this ignores structure. The numbers 8 and 9 are adjacent additively, yet multiplicatively alien: 8 = 2³ and 9 = 3² share nothing.
Tree distance measures something different: how similar are the prime factorizations? We define d(a, b) as the sum of absolute differences in prime exponents:
d(a, b) = Σp prime |ep(a) − ep(b)|
This is the L¹ norm in the infinite-dimensional space where each axis is a prime. Every positive integer is a point in this space; d(a,b) is their Manhattan distance.
Some consequences: d(n, 2n) = 1 always — multiplying by a prime moves you one step.
d(n, n²) = Ω(n) — squaring can move you arbitrarily far. Powers of a single prime
form a line: d(2, 4) = d(4, 8) = d(8, 16) = 1. But different primes are orthogonal: d(2, 3) = 2.
The neighborhood visualization shows which numbers are "close" to a given center. Notice how the neighbors of 12 = 2² × 3 include 6, 24, 4, 36 — numbers related by multiplying or dividing by small primes — but not 11 or 13 (primes far from 12's structure).
This metric has been studied in various forms: it appears in the analysis of the multiplicative group of integers, in approximation theory, and connects to the radical of a number (the product of its distinct prime factors). Here we make it visual.