What does it mean for two numbers to be close together?
You'd probably say: subtract them, and if the result is small, they're close. and are close. and are not. That's the only rule you've ever needed, and it feels less like a rule and more like a fact about reality.
It isn't. It's a choice. And once you see the other choices available, a strange and genuinely useful number system falls right out of them.
What if "close" meant something other than "small difference"?
Here's the choice hiding inside ordinary distance: two numbers are close when their difference has a small size. Pick a prime number instead, and ask a completely different question: how many times does divide their difference? The more times divides , the closer we'll declare and to be, no matter how big the numbers themselves are.
Try it with . Take and . On the real line they're pretty far apart, units. But . That difference is divisible by three whole times. Under this new rule, and are actually quite close.
Drag below and watch the two rulers argue with each other.
Drag b and watch the two rulers disagree. The same pair of numbers can be far apart on the real line but right next to each other on the p-adic ring.
Notice what's happening. The real-number ruler only cares about magnitude. The -adic ruler only cares about divisibility by . They're both legitimate ways to measure distance, and they disagree constantly. Neither one is the "real" answer. They're just different lenses.
How do you actually measure "divisible by p-ness"?
To make this rigorous we need a number that captures how divisible something is by . We call it the -adic valuation, written , and it's exactly what it sounds like: keep dividing by as long as it comes out even, and count how many times you managed it.
with : , , and isn't divisible by anymore. Two successful divisions, so .
Once you have the valuation, the -adic absolute value is just:
A number that's divisible by many times gets a tiny -adic absolute value. A number not divisible by at all gets , the biggest it can be. Divisibility makes numbers small in this world, not size. That flips your intuition upside down on purpose.
Pick a number, pick a prime, and watch the machine peel off factors of one at a time until it can't anymore.
Pick n and a prime p. The machine keeps dividing by p as long as it divides evenly. However many times it succeeds is the p-adic valuation.
Can a number have infinitely many digits... to the left?
Here's where it gets genuinely strange. In the ordinary decimal system, you can write infinitely many digits to the right of the decimal point. Think of for . But you'd never write infinitely many digits to the left. A number like doesn't mean anything on the real line. It would have to be infinitely large.
In the -adic world, infinite digits to the left is exactly how you build new numbers, and they land on perfectly ordinary values.
Take and look at the string , meaning "" repeated forever to the left. Truncate it at digits and you get (written in base , that's copies of the digit ). Now check what equals: it's just . That means gets -adically closer and closer to as grows, because , and we just showed higher powers of mean smaller -adic distance.
So (base ) really is a legitimate way to write . Slide and watch the ring depth increase as more digits get added.
Slide k to reveal more digits of −1 written in base p, growing to the left forever. Each new digit drills the running total one ring closer to −1.
This is the payoff of allowing infinite digits leftward: the p-adic integers aren't some abstract construction bolted onto the number line. They're what you get when you let base-p digit strings run forever in the other direction.
Watch a sum explode in one world and settle down in the other
Now for the reveal that makes all of this worth caring about. Consider the sum .
On the real number line, this is hopeless. Every term is bigger than the last, and . There's no sense in which this sum "converges" in the usual meaning of the word.
But look at it -adically. Each new term you're about to add is a higher and higher power of , which means it's -adically tinier and tinier. The partial sums stop wandering and start homing in on a fixed target: .
Same sequence of numbers. One metric says it flies apart. The other says it converges. Press play and watch both happen at once.
Sₙ = 1 + p + p² + … + pⁿ. Watch the same growing sum blast off the real number line while it drills straight toward one fixed point p-adically.
That's not a trick of notation. It's a real, useful fact: whether a sequence "converges" depends entirely on which notion of distance you're using, and the -adic notion makes a huge class of previously-useless sums behave.
So why do mathematicians actually care?
Because this isn't just a curiosity, it's a working tool. Equations that are hard to solve over the ordinary numbers sometimes become tractable once you check them -adically for every prime instead, an approach called the local-global principle. Number theorists use -adic analysis to prove statements about ordinary integers that plain real-number methods can't touch, and Andrew Wiles' proof of Fermat's Last Theorem leans on -adic machinery (Galois representations built over -adic fields) to get there. Closer to computing, the same "measure closeness by shared low-order digits" idea underlies parts of coding theory and cryptography.
None of that requires you to distrust the real numbers. It just means the real numbers were never the only sensible way to measure distance, and for certain problems, a different ruler is exactly the tool that fits.
So, what are p-adic numbers?
They're what you get when you redefine "close" around divisibility by a prime instead of size, then follow that definition all the way to its logical end: numbers with infinite digit strings extending left, sequences that converge in ways real numbers never could, and a genuinely different, self-consistent number system sitting right alongside the one you already know. The real numbers finish the rationals by filling gaps using ordinary distance. The -adic numbers finish the same rationals by filling gaps using a completely different notion of distance. Both are equally valid completions of the same starting set, they just look for gaps in different places.