Finding the 12th Term of OEIS A198683
How many distinct numbers can you make by parenthesizing 12 copies of i^i^...^i? A short explanation of how we squeezed the answer to 2926.
- math
- oeis
- python
Take copies of the imaginary unit , put ^ between them, and add parentheses in every possible way. How many different numbers do you get?
That is OEIS A198683.
With 3 copies of , there are two ways to parenthesize:
Different values, so . With 4 copies there are 5 parenthesizations, but two pairs collide, leaving .
For years, the OEIS stopped at , with a note saying was “either 2919 or 2926”, unconfirmed. Using Python, ball arithmetic, and exact algebra, we settled it—and 2926 is now published in OEIS A198683:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Bracketings | 1 | 1 | 2 | 5 | 14 | 42 | 132 | 429 | 1,430 | 4,862 | 16,796 | 58,786 |
| Distinct values | 1 | 1 | 2 | 3 | 7 | 15 | 34 | 77 | 187 | 462 | 1,152 | 2,926 |
The code and the full tables are on GitHub.
Why got stuck
Power towers of explode—and collapse—faster than ordinary computer arithmetic can handle.
- Too big: At , one bracketing reaches about . Raising to that gives a number around . Raising to that at blows past every floating-point format on earth.
- Too close to 1: Another bracketing sits within of without actually being . Standard floats round it straight to and undercount.
In 2017, Jon E. Schoenfield mapped out every bracketing through , but hit a wall at : 27 bracketings overflowed, 2 underflowed to zero, and rounding error couldn’t be ruled out.
The idea: squeeze the answer from both sides
If you just approximate numbers with floats, you can never be sure two expressions are truly equal—maybe they just match to 500 digits. And proving two messy expressions are different with pure algebra is notoriously hard.
So we split the job in two, using a single trick first:
1. Store logarithms instead of raw numbers
Instead of storing a value , we store its principal logarithm (with angle in ). Two numbers are equal if and only if their principal logarithms are equal, and computing becomes:
where reduce subtracts whole multiples of to keep the angle in .
A monstrous number of size now has a logarithm of size —easy for a computer to store.
2. Lower bound: prove numbers are different
We compute every logarithm with Arb at 3,000 bits of precision. Instead of a single guess, Arb wraps each number in a ball (a center plus a guaranteed error radius).
If two balls don’t touch, the two numbers are provably different. Counting non-overlapping groups gives a rigorous lower bound on .
3. Upper bound: prove numbers are equal
Alongside each ball, we keep an exact symbolic expression for using exact algebraic rewrite rules (no rounding at all).
If two bracketings simplify to the exact same symbolic form, they are provably equal. Counting distinct forms gives a rigorous upper bound on .
When we run this for :
- Lower bound: 2926
- Upper bound: 2926
Both sides meet, pinning down in about two seconds.
The catch at (and why stops here)
Six bracketings at produce a number so extreme——that computing its angle would take roughly bits of precision. That is physically impossible.
Luckily, we don’t need its angle for :
- All six bracketings have provably identical inputs, so they definitely produce one value.
- Its size alone separates it from the other 2,925 values (the next smallest is only around ).
At , though, that mystery-angle number gets plugged into new powers where its angle does matter. That is where this method hits a wall.
Checks—and how to refute it
Running uv run a198683 verify runs five sanity checks:
- Matches Schoenfield’s published tables for all 23,714 bracketings through , line for line.
- Brute-forces all 58,786 bracketings at individually—still 2,926 disjoint groups.
- Reproduces the exact 2017 overflows and underflows (and resolves all of them).
- Confirms no resolved value ever lands on the branch cut.
- Recounts independently using
mpmathat 3,000 digits, with no balls and no algebra.
Want to try it—or prove it wrong? Clone the repo; the full 58,786-line table is in tables/a198683_n12.txt. A single wrong line refutes the result.
uv sync
uv run a198683 count # ~2 seconds
uv run a198683 verify # ~90 seconds