The rational numbers are the most familiar numbers: 1, -5, ½, and every other value that can be written as a ratio of positive or negative whole numbers. But they can still be hard to work with.

The problem is they contain holes. If you zoom in on a sequence of rational numbers, you might approach a number that itself is not rational. This short-circuits a lot of basic mathematical tools, like most of calculus.

Mathematicians usually solve this problem by arranging the rationals in a line and filling the gaps with irrational numbers to create a complete number system that we call the real numbers.

But there are other ways of organizing the rationals and filling the gaps: the p-adic numbers. They are an infinite collection of alternative number systems, each associated with a unique prime number: the 2-adics, 3-adics, 5-adics and so on.

The p-adics can seem deeply alien. In the 3-adics, for instance, 82 is much closer to 1 than to 81. But the strangeness is largely superficial: At a structural level, the p-adics follow all the rules mathematicians want in a well-behaved number system.

Developed over a century ago, p-adic numbers have become an essential setting in which to investigate questions about rational numbers that go back millennia.

**Building the Tower**

The p-adic numbers are based in modular arithmetic, which is a method of counting that loops back on itself, like a clock. Just as 1300 on a 24-hour clock is the same as 1 p.m., mathematicians say that 13 “modulo 12” is equivalent to 1.

To see how p-adic number systems emerge from modular arithmetic, start by classifying all integers modulo a specific prime number. Classifying the integers modulo 3, for example, sorts them into three buckets, or rooms.

You could also classify integers modulo higher powers of 3: modulo 9 (3^{2} ) or modulo 27 (3^{3}).

Mathematicians sort integers modulo powers of 3 to detect features of their prime factorizations: Integers that are equivalent to 0 modulo 3 are in the same room and have at least one 3 in their prime factorizations; integers that are equivalent to 0 modulo 9 have at least two; integers equivalent to 0 modulo 27 have at least three.

Now imagine the integers modulo 3, 9 and 27 stacked atop each other like a tower. Each level of the tower is an exact threefold covering of the level below it. This pattern continues forever, creating an elegant arrangement of the integers modulo ever-higher powers of 3.

Each p-adic integer is defined by following an infinite path up the tower. A bird’s-eye view of this tower gives a picture of all the p-adic integers.

One of the biggest advances in 21st-century mathematics is an object called a “perfectoid space,” which embodies this perspective. It was developed by Peter Scholze of the University of Bonn, who won the Fields Medal in 2018 in part for this work. It’s just one example of how mathematicians make use of these infinitely layered towers.

“Instead of considering the individual levels of the tower, you consider the whole tower at once,” said David Savitt of Johns Hopkins University. “This is a fundamental insight that crops up everywhere in modern number theory, in the Langlands Program and arithmetic geometry.”

**Alien Arithmetic**

Mathematicians write p-adic numbers based on the frequency with which each power of p appears in the number’s “base p” expansion. For example, this is how you write 11 in the 3-adics:

The size of a p-adic number is determined by the prevalence of p in its prime factorization. Numbers with more ps are smaller. For example, in the 3-adics, 486 is “small” because it has many 3s in its prime factorization (486 = 2 x 3 x 3 x 3 x 3 x 3).

Another way to think about size is to think about which numbers are close to 0. In the p-adics, integers are closer together when they share a room at higher levels of the tower. The numbers 0 and 486 share a room up to the fifth level, whereas 0 and 6 share a room on only the first level—indicating that 0 is closer to 486 than to 6 (and thus 486 is smaller than 6).

The p-adic towers accommodate fractions by expanding the tower belowground. Numbers with large powers of p in the numerators are small, and numbers with larger powers of p in the denominators are large.

Arithmetic has a different feel, too. Take, for example, the sum 486 + 486 = 972. In the real numbers, 972 is much bigger than 486. But in the 3-adics, 972 is the same size as 486, because both the sum (972) and the summand (486) have the same number of 3s in their prime factorization.

The p-adics take a different shape than the real number line: They form a fractal made of the infinitely nested rooms at the “top” of the p-adic tower. But this fractal has its own gaps. Mathematicians fill them by forming the “completion” of the p-adic rationals—a procedure analogous to adding irrational values to the number line. In this sense, at least, the principles underlying the p-adic numbers and the real numbers are similar.

“They’re all completions, so they actually have a lot in common,” said Jessica Fintzen of the University of Cambridge and Duke University.

**One Big Family**

The infinite family of p-adic number systems provides mathematicians with a wide range of settings in which to explore questions about rational numbers.

For example, mathematicians would like to know when polynomial equations like 3*x*^{3} + 4*y*^{3} + 5*z*^{3} = 0 have rational solutions. This is generally a hard question. But it’s relatively easy to find p-adic solutions.

“Things want to be nice over the p-adics. They want to have solutions,” said Bianca Viray of the University of Washington.

One tool mathematicians use to answer this question is the local-global principle, or the Hasse principle, which dates to the 1920s. It proposes that if a polynomial has a solution in the real numbers and in all of the p-adic numbers, then that polynomial also has a solution in the rational numbers. The local-global principle is true for some types of polynomials but not others.

The premise behind the local-global principle seems strange: To prove the existence of solutions within the rational numbers, mathematicians look for solutions in infinitely many other number systems—the reals and all the p-adics.

The need to work like this highlights the extent of the problems created by the holes in the rational numbers: You need to cross the universe just to get around them. At the same time, it suggests that in a cosmos of infinitely many number systems, it would be almost strange to restrict ourselves to the one that just happens to be closest to home.

“We’re all on Earth and we work with the reals, but if you went [anywhere] else, you’d work with the p-adics,” Viray explained. “It’s the reals that are the outliers.”