A different meaning of "close"
Ordinary distance is about magnitude: |7 − 3| = 4, and two numbers are close if that gap is small. The p-adic numbers, introduced by Kurt Hensel in 1897, throw that idea out and replace it with divisibility. Fix a prime p. Two integers are p-adically close if their difference is divisible by a high power of p — the more times p divides the gap, the closer the numbers are considered, no matter how large that gap is in the ordinary sense.
Concretely: with p = 2, the numbers 0 and 100000000 (which is 2⁸ × 390625) are extremely close 2-adically, because their difference is divisible by 2⁸. Meanwhile 0 and 1 are as far apart as two numbers can be, since 1 isn't divisible by 2 at all. This flips ordinary intuition on its head — the "biggest" integers in the usual sense can be the ones sitting right next to zero.
The valuation and the metric formula
Formally, the p-adic valuation v_p(n) of a nonzero integer n is the exponent of p in its prime factorization — how many times p divides n. The p-adic absolute value and the p-adic distance are then defined directly from it:
v_p(n) = the exponent of p in the prime factorization of n |n|_p = p^(-v_p(n)) (and |0|_p = 0 by convention) |x-y|_p = p^(-v_p(x-y)) <-- the p-adic DISTANCE between x and y example, p = 2: v_2(8) = 3 -> |8|_2 = 2^-3 = 0.125 v_2(1) = 0 -> |1|_2 = 2^0 = 1 8 is "smaller" (closer to 0) 2-adically than 1, despite 8 > 1 normally
This is a genuine metric — it satisfies positivity, symmetry, and a triangle inequality — so the p-adic numbers form a legitimate metric space, just a deeply unfamiliar one. Completing the rationals under this new metric, the same way completing them under the ordinary absolute value produces the real numbers, produces an entirely different number system: ℚ_p, the field of p-adic numbers.
Ultrametric: the strong triangle inequality
The p-adic metric actually obeys something stronger than the usual triangle inequality — the ultrametric or "strong triangle" inequality, d(x,z) ≤ max(d(x,y), d(y,z)) instead of merely d(x,y) + d(y,z). This has strange but precise consequences: every triangle is isosceles, with the two longest sides always equal; every point inside an open ball is a valid center of that ball; and two balls are either disjoint or one contains the other entirely — they can never partially overlap. These are exactly the properties of a hierarchical branching structure, which is why p-adic numbers are naturally drawn as an infinite tree rather than a line: at each level you branch into p children according to the next digit of a base-p expansion, and distance in the metric corresponds directly to depth of the shared ancestor.
Why mathematicians actually use this
p-adic analysis isn't a curiosity kept in a museum case; it's load-bearing machinery in modern number theory. Hensel's lemma lets you lift a solution of a polynomial equation modulo p to an exact solution in ℚ_p, essentially a p-adic version of Newton's method. The Hasse local-global principle asks whether a Diophantine equation solvable in every ℚ_p (and in the reals) is solvable in the rationals — true for quadratic forms, famously false in general. And Andrew Wiles's 1994 proof of Fermat's Last Theorem is built on p-adic Galois representations of elliptic curves, connecting this 19th-century curiosity directly to one of the most famous theorems in mathematics.
Frequently asked questions
What does it mean for two numbers to be p-adically close?
Two integers are p-adically close if their difference is divisible by a high power of p. 16 and 0 are very close 2-adically because 16 = 2⁴, even though they are far apart on the ordinary number line, because the p-adic valuation only cares about divisibility, not magnitude.
What is the ultrametric (strong triangle) inequality?
It replaces d(x,z) ≤ d(x,y) + d(y,z) with the stronger d(x,z) ≤ max(d(x,y), d(y,z)). One consequence is that every triangle in a p-adic space is isosceles with the two longer sides equal, and every point inside a ball is a valid center for that same ball.
Are p-adic numbers just a mathematical curiosity?
No — they are a standard tool in modern number theory (Hensel's lemma, the local-global Hasse principle, Andrew Wiles's proof of Fermat's Last Theorem uses p-adic Galois representations) and have found applications in string theory, cryptography and models of hierarchical data such as phylogenetic trees.
Try it live
Everything above runs in your browser — open p-adic Number Ultrametric Space and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open p-adic Number Ultrametric Space simulation