Skip to content

b-adic Numbers

Positional notation writes a number as digits that stop on the left and may run forever on the right: . Turn that around — digits that stop on the right and run forever on the left — and the same long division gives , because . Those are the -adic numbers: the completion of the rationals under the rule that divisible by a high power of means small.

AdicNumeral(b, x) is the value; AdicNumerals(b) is the matching numeral system in the base slot of IntegerDigits. On the non-negative integers the two directions agree digit for digit. Everywhere else they part ways, and this page is a tour of where.

The same digits, the other way round

ℕ: nothing changes

The 10-adic digits of 42 are the decimal digits of 42, padded to the cut: the expansion has no left end, so the width is part of the numeral. The residue system with moduli 16 and 625 reads the same last four digits mod each.

source
<notatio-cell value="IntegerDigits(42, 10)" />
<notatio-cell value="IntegerDigits(42, AdicNumerals(10, 6))" />
<notatio-cell value="AdicExpansion(AdicNumeral(10, 42))" />
<notatio-cell value="IntegerDigits(42, ResidueSystem([16, 625]))" />

Negatives: a sign, or infinitely many nines

Fixed radix drops the sign. Balanced ternary spells it with negative digits. The -adics spell it with digits alone, infinitely many of them: , because adding 1 carries forever and leaves zero. A residue system wraps instead — mod 7 is 4 — which is the same idea cut at each modulus.

−3, four ways

Positional, balanced, adic, residue. The adic string is the one that makes −3 + 3 = 0 by ordinary column addition.

source
<notatio-cell value="IntegerDigits(-3, 10)" />
<notatio-cell value="IntegerDigits(-3, BalancedRadix(3))" />
<notatio-cell value="AdicExpansion(AdicNumeral(10, -3), 8)" />
<notatio-cell value="IntegerDigits(-3, AdicNumerals(10, 8))" />
<notatio-cell value="FromDigits([9, 9, 9, 9, 9, 9, 9, 7], AdicNumerals(10))" />
<notatio-cell value="IntegerDigits(-3 % 77, ResidueSystem([7, 11]))" />

FromDigits with AdicNumerals reads a digit string back as the residue nearest zero, which is what makes the negatives round-trip: eight nines and a seven is , not . The width does the work — [7] alone reads as too. That is the price of a system with no left end: a numeral is a string of a given width, exactly as in two's complement.

Adding −1 and 1

The arithmetic is the ordinary ring arithmetic; the printed form is what a column addition of …999 and 1 leaves behind.

source
<notatio-cell value="AdicNumeral(10, -1) + 1" />
<notatio-cell value="AdicExpansion(AdicNumeral(10, -1), 6)" />
<notatio-cell value="AdicExpansion(AdicNumeral(2, -1), 8)" />

Rationals: to the right, to the left, or in every channel at once

has no finite decimal — the digits recur to the right. It has no finite -adic expansion either — the digits recur to the left — but as a -adic integer it is a perfectly good element: , and multiplying by 3 gives 1. A residue system gets there a third way: is whatever multiplies 3 to give 1 in each channel independently, which is the modular inverse.

1/3

Left: 10-adic, and its check. Right: the residue system's answer is 26, because 26 × 3 = 78 ≡ 1 mod 77 — and 26 is exactly what the last two adic digits give mod 100: 67 × 3 = 201.

source
<notatio-cell value="AdicExpansion(AdicNumeral(10, 1 / 3), 8)" />
<notatio-cell value="AdicNumeral(10, 1 / 3) * 3" />
<notatio-cell value="IntegerDigits(PowerMod(3, -1, 77), ResidueSystem([7, 11]))" />
<notatio-cell value="FromDigits([5, 4], ResidueSystem([7, 11]))" />
<notatio-cell value="67 * 3 % 100" />

The base decides which rationals are integers. In , is an integer and is not — there is no -adic digit string that 2 multiplies to , since anything ends in an even digit. Same in : is the alternating , and has no expansion at all.

Which rationals are integers

1/3 in ℤ₂ and ℤ₁₀; 1/2 declines in both. The last cell is 1/3 in ℤ₇ — every base coprime to 3 has one.

source
<notatio-cell value="AdicExpansion(AdicNumeral(2, 1 / 3), 8)" />
<notatio-cell value="AdicNumeral(10, 1 / 2)" />
<notatio-cell value="AdicNumeral(2, 1 / 2)" />
<notatio-cell value="AdicExpansion(AdicNumeral(7, 1 / 3), 8)" />

Prime bases are fields; composite bases have zero divisors

For a prime the story completes: is a field, and dividing by just moves the point. in is — two digits past the point, because . The valuation counts those places: , . The norm is the distance: is small -adically, at from zero.

ℚ₅

A point in the numeral, and the valuation that says where it goes.

source
<notatio-cell value="AdicExpansion(AdicNumeral(5, 7 / 25), 8)" />
<notatio-cell value="AdicNumeral(5, 3) / 5" />
<notatio-cell value="AdicValuation(AdicNumeral(5, 75))" />
<notatio-cell value="AdicNorm(AdicNumeral(5, 75))" />
<notatio-cell value="AdicUnitPart(AdicNumeral(5, 75))" />

A composite base gives a ring instead, and a strange one. contains two numbers with , , , and — neither of them is or . They come from Hensel lifting from its roots and mod , and they are the reason : one idempotent is and the other . This is the residue system's "independent channels" again, at infinite precision. A residue system with moduli is the -adic truncation with its two factors pulled apart.

Zero divisors in ℤ₁₀

…890625 and …109376: each is its own square, they sum to 1, and their product is 0. No prime base has anything like them.

source
<notatio-cell value="AdicExpansion(HenselLift(x ^ 2 - x, 5, 10, 8))" />
<notatio-cell value="AdicExpansion(HenselLift(x ^ 2 - x, 6, 10, 8))" />
<notatio-cell value="HenselLift(x ^ 2 - x, 5, 10, 8) * HenselLift(x ^ 2 - x, 6, 10, 8)" />
<notatio-cell value="HenselLift(x ^ 2 - x, 5, 10, 8) + HenselLift(x ^ 2 - x, 6, 10, 8)" />
<notatio-cell value="IntegerDigits(12890625, ResidueSystem([256, 390625]))" />

Roots that exist nowhere else

Hensel's lemma is Newton's method run in : a simple root mod lifts to a root mod every , doubling its correct digits each step. So exists in (since ), exists in (since ), and does not exist in at all. These values are known only to a precision, and print with their O-term; arithmetic with them carries the precision along.

Hensel

A square root of 2 in ℤ₇ to six digits, squared back; the same root by HenselLift; −7's root in ℤ₂; and 3's absence in ℤ₇.

source
<notatio-cell value="AdicSqrt(AdicNumeral(7, 2), 6)" />
<notatio-cell value="AdicSqrt(AdicNumeral(7, 2), 6) ^ 2" />
<notatio-cell value="HenselLift(x ^ 2 - 2, 3, 7, 6)" />
<notatio-cell value="AdicExpansion(AdicSqrt(AdicNumeral(2, -7), 10))" />
<notatio-cell value="AdicSqrt(AdicNumeral(7, 3))" />

Where they align and where they differ

on…positional base residue system -adic
digits of , each channelthe same digits, padded to the cut
a signwraps: infinitely many leading :
recurs to the right, if it existsrecurs to the left: ; an integer
in base 10, if odddoes not exist in
in base 5needs : digits past the point,
in base 7irrational, no finite stringa residue mod each , no coherencea genuine element of , by Hensel
, none and across channels and in ; none for prime
"close to zero"small absolute valuedivisible by a high power of
moduli , is the -adic truncation, split by primereads back mod each

The last row is the one to keep. A residue system whose moduli are the prime-power factors of carries exactly the information of the last -adic digits — the Chinese remainder theorem is the isomorphism , and letting is what turns the residue system's independent channels into .

Things worth knowing

Exact until it isn't. AdicNumeral(10, 1/3) is an exact rational, and its expansion can be produced to any depth. A Hensel lift is known only modulo and says so with + O(b^prec); anything computed from it inherits the cap. The default precision is 20 digits.

Composite bases decline division by non-units. AdicNumeral(10, 3) / 2 is left standing: 2 has no inverse in , and there is no -adic field to put in. Prime bases divide by anything non-zero.

Digits are listed least significant first. AdicDigits lists from the valuation upward, because that is the end the expansion has; AdicExpansion prints them the familiar way round with the infinite end marked by an ellipsis.

Pinned against Sage. Expansions, valuations, square roots and products are checked against Sage's Zp/Qp for prime bases; Sage has no composite bases, so those are pinned by their algebra — the idempotents, the zero divisor, .