Skip to content

Complex Bases ​

In base ten, the number 372372 is 3⋅102+7⋅10+23 \cdot 10^2 + 7 \cdot 10 + 2: a sum of digits times powers of the base. Nothing in that recipe needs the base to be real. Take a Gaussian integer for the base, say β=−1+i\beta = -1 + i, and a set of digits, here {0,1}\{0, 1\}. A numeral dL−1…d1d0d_{L-1} \dots d_1 d_0 then stands for

∑k=0L−1dkβk,\sum_{k=0}^{L-1} d_k \beta^k,

and every one of them is a point in the plane. The plot below draws all 2122^{12} numerals of at most twelve places. Each tile is one numeral, colored by its digit in the twelfth place, which splits the dragon into the two halves it is made of.

Base −1 + i, digits 0 and 1

Base , digits 0, , at most places, colored by the digit in the last place: . Try the twindragon, Knuth's quater-imaginary base, base −2 + i, the Gosper island, base −1 + ω or a plain square.
source
<Labeled
  Variables='[
    _e -> Variable(ComplexBases, "twindragon"),
    _r -> [Labeled(GaussianIntegers, "ℤ[i]"), Labeled(EisensteinIntegers, "ℤ[ω]")],
    _b -> Variable(_r, (-1, 1)),
    _ds -> Variable(_r, [(1, 0)]),
    _L -> Variable(Integers, 12, Range -> [1, 14])
  ]'
>
  <Show ImageSize="[Automatic, 520]">
    <LatticeTiles
      ColorRules='[True -> ColorData("Tableau10")(Digit(_L))]'
      BoundaryStyle="[IsDigit -> White, Overlaps -> Directive(Red, AbsoluteThickness(1.5))]"
    >
      <RadixExpansions Example="_e">_r _b _ds _L</RadixExpansions>
    </LatticeTiles>
    <Locator Appearance='"β"'>_b</Locator>
    <Locator LocatorAutoCreate>_ds</Locator>
  </Show>
  <StringTemplate>Base $\beta = _b$, digits 0, {_ds}, at most {_L} places, colored by the digit in the last place: {_e}. Try {Setter(_e, "twindragon", "the twindragon")}, {Setter(_e, "quater-imaginary", "Knuth's quater-imaginary base")}, {Setter(_e, "katai-szabo", "base −2 + i")}, {Setter(_e, "gosper-island", "the Gosper island")}, {Setter(_e, "eisenstein-three", "base −1 + ω")} or {Setter(_e, "square", "a plain square")}.</StringTemplate>
  Bottom
</Labeled>

Every system in the caption's menu, notable and favorite, draws the same way. Drag β\beta or a digit to change the system, and ⌥-click to add a digit or take one away.

One digit per residue class ​

Two numerals can name the same point. Base 2i2i with digits 00 to 33 (Knuth's quater-imaginary system) has 2=−i⋅2i2 = -i \cdot 2i, so 22 and 00 leave the same remainder mod 2i2i. Its whole numerals only reach points with an even imaginary part, and Knuth writes the rest with a radix point.

The cure is to choose the digits as a complete residue system mod β\beta: one digit from each class, with 00 among them. There are then exactly ∣N(β)∣|N(\beta)| digits (N(a+bi)=a2+b2N(a + bi) = a^2 + b^2), and no two numerals can collide. To see why, suppose two of them name the same point, and look at the lowest place kk where they differ. Their difference is a multiple of βk\beta^k. Divide it out: what remains is dk−dk′d_k - d'_k plus a multiple of β\beta. That sum is 00, so dk≡dk′(modβ)d_k \equiv d'_k \pmod \beta, and two different digits from different classes can't be congruent.

Every notable system here except the quater-imaginary one has a complete residue system. The tests check that its numerals are all different points.

Distinct is not the same as every point. Base −1+i-1 + i with digits {0,1}\{0, 1\} reaches every Gaussian integer, which Penney and Knuth showed. Kátai and Szabó found that −n+i-n + i with digits 0,1,…,n20, 1, \dots, n^2 does too. Many complete residue systems don't. Some lattice points then have no numeral at all, and the tiles leave gaps however many places you allow.

Tiles that are fractals ​

Adding a place multiplies everything by β\beta and adds a digit:

TL+1=⋃d∈D(d+β TL).T_{L+1} = \bigcup_{d \in D} \left(d + \beta\, T_L\right).

Scaled back by βL\beta^{L}, the sets TLT_L settle onto a single tile TT that is ∣N(β)∣|N(\beta)| copies of itself, each shrunk by 1/∣β∣1/|\beta| and turned by −arg⁡β-\arg \beta. For base −1+i-1 + i that is two copies, turned by 135°135°: the twindragon, two Heighway dragons back to back. For the Gosper island, base 3+ω3 + \omega with 00 and the six units as digits, it is seven copies, turned by arctan⁡(3/5)≈19.1°\arctan(\sqrt 3 / 5) \approx 19.1°.

Coloring by digits ​

Each coloring reads one thing off a numeral's digits, and gives each digit its own color from the discrete scheme:

  • leading digit colors a numeral by its most significant digit.
  • the k-th digit colors by the digit in place kk; the 1st digit is the units digit. The 1st digit is the residue class mod β\beta, so it splits the plane into ∣N(β)∣|N(\beta)| interleaved sublattices. The highest place splits it into ∣N(β)∣|N(\beta)| copies of the tile.
  • all digits mixes the digits' colors, the leading digit weighing most: a numeral's color is 0.80.8 of its leading digit's color plus 0.20.2 of the color of the rest. Numerals that agree on their leading places look alike, so the self-similar copies show at every scale.

Off the lattice ​

Untick on the lattice and the base and digits can sit anywhere in the plane. The numerals are no longer lattice points, residue classes no longer make sense, and nothing keeps two numerals apart. The tiles drift, overlap, or spread into clouds. Drag the handles slowly from a lattice system to watch a tile come apart.

Settings and favorites ​

The settings box holds the current system as a sentence, such as base -1+i with digits 0, and 1 color by 1st. Copy it to keep a system, or paste one to load it. The sentences follow TheGrayCuber's imaginary-bases page, which inspired this one. The caption's menu also lists the favorites viewers sent there, each credited as submitted. (On that page, here, and in the quadratic integers guide, ω=e2πi/3\omega = e^{2\pi i/3}, so ω2=−1−ω\omega^2 = -1 - \omega.)

The full explorer, with every control, is on the complex bases exploration.