Inside “3-adica”

by Greg Egan

In my novella “3-adica,” [in the current issue on sale now] Sagreda and Mathis are digital beings, trapped in a network of exploitative virtual reality games and forced to act out the roles that none of the customers want. They’ve learned how to travel from game to game, but they’re desperate to seize control of their fate by reaching the legendary game of 3-adica, a world reputed to have rules so bizarre that they could test the network’s software to destruction.

The story begins in a pastiche of Victorian London, ruled by a vampire elite, that the heroes must pass through on their way to 3-adica. But since the laws that govern vampires are already well-known, this blog post will describe the less familiar rules that govern the 3-adic numbers.

In many respects, the 3-adic numbers are the same as the familiar integers and fractions that everyone learns about in school. They are added, subtracted, multiplied and divided in exactly the same fashion. What is different is the notion of the size, or magnitude, of a number. We would normally say that the magnitude of the number 18, say, is just 18. But if we’re playing by the rules of the 3-adic numbers, we would say that the magnitude of 18 is 1/9. We will write this as:


This might seem rather strange, but it follows from a reasonably simple rule. To find the magnitude of an integer as a 3-adic number, we ask for the highest power of 3 that divides it. We then assign a magnitude that is 1 divided by 3 raised to that power. Since 9, or 3 squared, is the highest power of 3 that divides 18, it follows that |18|=1/9.

Using this rule, the magnitudes of the numbers up to 20 are:





If we want to know the 3-adic magnitude of a fraction, we take the ratio of the magnitudes of the numerator and denominator. So we have, for example:






What do we gain by redefining the size of numbers this way? To see where this is taking us, we should first switch to writing numbers in base 3. That is, instead of digits in different positions corresponding to powers of 10, we will treat them as corresponding to powers of 3. For example:

121 (base 3) = 1×9 + 2×3 + 1 = 16 (base 10)

If we measure the size of numbers in the usual way, when we start adding digits to the right of the decimal point, the new digits make less and less difference to the number. The two numbers 1.2345 and 1.23456 are not much different, because their difference, 0.00006, is small.

But if we use the 3-adic magnitude instead, the two numbers 21011 (base 3) and 121011 (base 3) are not much different, because their difference, 100000 (base 3) = 243 (base 10), has |243|=1/243. So with 3-adic numbers, adding digits to the left side of the number, when it is written in base 3, makes less and less difference the further left you go.

We’re used to writing repeating decimals that continue on forever to the right, such as:

0.1666 . . . = 1/6

With 3-adic numbers, we can have repeating digits that stretch on forever to the left, such as:

. . . 1112 (base 3) = 1/2

Here, the sequence of 1s should be thought of as never-ending, just like the sequence of 6s in the decimal for 1/6.

How can we show that . . . 1112 (base 3) really is 1/2? If we double it, the 2 becomes 4, but in base 3 we write that as 11 (base 3), so we get a 1 in the rightmost column, and carry a 1. Doubling the 1 in the next column to the left gives 2, but then we add in the carried 1 to make 3, or 10 (base 3). We write a zero, and carry a 1 again . . . and so on, ad infinitum. So we have:

2 × . . . 1112 (base 3) = . . . 0001 (base 3) = 1

Doubling the number we started with gives 1, so the original number must have been 1/2. But this also tells us that we can get a good approximation to 1/2 if we only use a finite number of digits on the left. Consider the approximation:

11112 (base 3) = 81 + 27 + 9 + 3 + 2 = 122 (base 10)

This ought to be very close to 1/2. If we double 122 we get 244, which is 243 + 1. And |243| = 1/243, a pretty small error.

We can even use these repeating digits on the left to write negative numbers, without any need for a minus sign. For example:

. . . 22222 (base 3) = –1 (base 10)

. . . 22221 (base 3) = –2 (base 10)

. . . 22220 (base 3) = –3 (base 10)

In the ordinary number system, when a decimal repeats the same pattern over and over, that means it describes an exact fraction, or rational number. But the ordinary numbers also include irrational numbers, such as the square root of 2, whose digits never repeat:

√2 = 1.414213562373095 . . . (base 10)

Since there is no rational number whose square is exactly 2, the fact that we say “the square root of 2 exists” is really making the claim that we can write an infinite sequence of rational numbers (namely 1, 1.4, 1.41, 1.414, 1.4142, . . .), such that however close to 2 we want to get (short of a perfect match), there comes a point in this sequence where all the subsequent numbers, when squared, will be at least that close.

But the 3-adic numbers differ from the ordinary numbers in precisely this matter of closeness, and it turns out that in the 3-adic sense, there is no square root of 2!

There are square roots of other numbers, though. For example:

3-adic √7 = . . . 222021120020111 (base 3)

To check that this really is a good approximation to the square root of 7, we’ll consider just the last five digits.

20111 (base 3) = 2×81 + 9 + 3 + 1 = 175 (base 10)

175 × 175 = 30625 (base 10)

30625 (base 10) = 1120000021 (base 3)

21 (base 3) = 7

All those zeroes in the base 3 representation of 30625 tell us that it is very close, in the 3-adic sense, to 7. To be precise:

|30625–7| = 1/2187

Why can’t there be a square root of 2, though? Surely we can at least get close? Can’t we just copy what we saw with 7, and find a number that is (A) an integer squared, and (B) differs from 2 by a (3-adically) “small” quantity that is divisible by a large power of 3?

The problem is, if you square any integer at all, its remainder after you divide by 3 will either be zero (when the number you squared was exactly divisible by 3), or 1, in every other case. If you then subtract 2, the result can’t possibly be divisible by even a single power of 3. So any number squared will lie at a 3-adic distance of at least 1 from 2.

This peculiar way of measuring the distance between numbers turns out to be much more than a game. Everything we’ve done with the number 3 can be generalized to any other prime number, p, to create what are known as the p-adic numbers. Working with this kind of number lets you combine different aspects of mathematics in a very fruitful manner, and even the famous proof by Andrew Wiles of Fermat’s Last Theorem employed techniques that used p-adic numbers.

In any case, I hope you’ve enjoyed this small glimpse into a different way of thinking about the size and closeness of numbers. Don’t worry, though: there’s no need to be able to compute 3-adic square roots in order to follow the story of “3-adica.”

And if the thought of being trapped in a place that obeys these bizarre laws makes your brain hurt, that’s precisely why Sagreda and Mathis are seeking out the world of 3-adica. Software that was written to deal with more ordinary games is going to have a hard time adapting to such strange rules . . . and if the cracks in the system start to show, maybe there’ll be a way to slip through them into freedom.

One thought on “Inside “3-adica””

  1. 3-atica is a superior example of “hard” science fiction. I think of “hard” as meaning that the more the reader knows about the STEM the story uses, the more he/she will enjoy and appreciate the story. Egan is a rare masterful author of “hard” science fiction. I own and have read every story he has written (thus far).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s