⚜ PRINCIPIA ORTHOGONA · Book IV · GTCT · Modular equations and π Chapter R →
Book IV · 2026-09-17 · The object, worked

Modular Equations and π

Two numbers show up in Ramanujan's formula for $1/\pi$. The same two numbers show up somewhere they have no business being. This is the chase.
RoleVol IV works the object
the finding is Vol VII's, the algebra Vol XI's
Prerequisitenone beyond square roots
and willingness to run a script
Producing scriptbook7/ch-ramanujan-1pi-verify.py
120-digit, standard library only
Explanation layer · you should be able to read this cold

1 · A formula that is too good

In 1914 Ramanujan published this, with no derivation:

$$\frac{1}{\pi} \;=\; \frac{2\sqrt 2}{9801}\sum_{n=0}^{\infty}\frac{(4n)!\,(1103 + 26390\,n)}{(n!)^4\,396^{4n}}$$

Take just the first term — set $n = 0$, so the sum is only $1103$ — and you get $1/\pi$ correct to eight decimal places. Add the next term, sixteen places. The one after that, twenty-four. Eight more digits every single time, forever.

Nobody beat it for seventy years.

Before we go anywhere, look at the two strange numbers sitting in it. There is 9801 out in front. There is 396 buried in the denominator. Nothing about the formula explains why those and not others.

Keep them in mind. We are going to walk away from this formula entirely, and when we come back they will be waiting.

2 · Somewhere else entirely

Forget $\pi$ for a moment.

There is a function called the elliptic modulus, written $k(q)$. You build it by dividing one infinite sum by another. It is the kind of object that has no closed form, takes ugly values, and does not simplify.

Now do something arbitrary-looking to it. Pick a whole number — say $58$ — and evaluate $k$ at the point $q = e^{-\pi\sqrt{58}}$. Square the answer and call it $\alpha_{58}$.

You have taken a transcendental function and fed it a transcendental input. You should get mud.

Here is what you get:

$$\alpha_{58} = (13\sqrt{58} - 99)^2\,(99 - 70\sqrt 2)^2$$

Square roots and whole numbers. The infinite sums are gone. You can check it: grind the theta series out to 120 digits, evaluate those radicals separately, and the two agree to eighty places.

That is already surprising. But look at what is in there.

99. Twice.

3 · The coincidence, sharpened

Go back and look at the two numbers we were told to remember.

$$9801 = 99^2, \qquad\qquad 396 = 4 \times 99$$

So a formula for $\pi$ and a value of an elliptic function — two things with no visible connection — are both built out of 99.

Either that is an accident, or these are the same object seen from two sides. The rest of this chapter is finding out which.

4 · Following it down

From $\alpha_{58}$ you can build a related quantity called the class invariant:

$$g_{58}^{12} = \frac{(k')^2}{2k}, \qquad k' = \sqrt{1-\alpha}, \quad k = \sqrt{\alpha}$$

Compute it. Here is what comes out:

$$g_{58}^{12} = 19601.99999489847\ldots$$

Stop on that for a second.

It is almost a whole number. Not quite. Five decimal places of agreement and then it drifts. If you were sloppy you would write down 19602 and move on, and you would have invented something.

So why is it so close? A number that misses an integer by five parts in a million is not doing that by chance.

5 · What it actually is

$$g_{58}^{12} = 9801 + 1820\sqrt{29}$$

There is 99 a third time — $9801$ again, now as the whole-number part of something irrational.

And this is not a random expression. It is $\varepsilon^6$, where

$$\varepsilon = \frac{5+\sqrt{29}}{2}$$

is the fundamental unit of $\mathbb{Q}(\sqrt{29})$ — roughly, the smallest multiplicative building block of that number system, the thing every other unit is a power of.

Units have a norm: multiply the number by its conjugate. For $\varepsilon$ that norm is $-1$. So for $\varepsilon^6$ it is $(-1)^6 = +1$.

Write that out. Norm $+1$ for $9801 + 1820\sqrt{29}$ says:

$$9801^2 - 29\cdot 1820^2 = 1$$

Check it: $96{,}059{,}601 - 96{,}059{,}600 = 1$. That is Pell's equation, and it lands exactly on 1.

6 · Why the near-miss was a near-miss

Here is the payoff, and it explains §4.

Norm $+1$ means the conjugate is the inverse:

$$g^{-12} = 9801 - 1820\sqrt{29}$$

So $g^{12}$ and $g^{-12}$ are a matched pair straddling $9801$ — one a hair above, one a hair below. And $g^{-12}$ is tiny, about $0.000051$. That is your five parts in a million. The near-miss was the inverse, hiding.

Now add them. The $\sqrt{29}$ terms are equal and opposite:

$$g^{12} + g^{-12} = 19602$$

Exactly. Thirty zeros after the decimal point, and not because anyone measured carefully — because Pell's equation says so.

And $19602 = 2 \times 99^2$.

7 · Closing the loop

One step left. The quantity that sets the series denominator is

$$x_N = \frac{1}{64\,(g^{12} + g^{-12})^2}$$

We know that bracket exactly now. So:

$$64 \times 19602^2 = 24{,}591{,}257{,}856$$

And:

$$396^4 = 24{,}591{,}257{,}856$$

The same number. Both sides are $256 \times 99^4$.

So it was not a coincidence The $9801$ in front of Ramanujan's series and the $396$ underneath it come from the same place: the unit group of $\mathbb{Q}(\sqrt{29})$, reached by evaluating an elliptic function at $e^{-\pi\sqrt{58}}$.

A transcendental function turns algebraic at special points. The algebra turns out to be a unit group. The unit's norm makes the answer a whole number. That chain has a name — complex multiplication — and it is the reason formulas like this exist at all.

8 · Now you can build your own

Nothing above used $58$ in an essential way. It is a dial, and it sets your convergence rate: bigger $N$, bigger denominator, more digits per term. Ramanujan turned it to $58$ and got eight digits. The Chudnovsky brothers turned it to $163$ and got fourteen — that is the formula every $\pi$ record has used since 1989.

Recipe
  1. Pick $N$. Compute $\alpha_N$ from the theta series at high precision. Compute it — do not look it up. Computing it is your check.
  2. Form $g_N^{12} = (1-\alpha_N)/(2\sqrt{\alpha_N})$.
  3. Add the inverse: $S = g_N^{12} + g_N^{-12}$.
  4. Is $S$ a whole number? If it is ragged, stop. Your precision is short, or this $N$ is not one where the trick closes.
  5. $x_N = 1/(64S^2)$, and $\log_{10}(1/x_N)$ minus the growth of $(4n)!/(n!)^4$ tells you your digits per term before you compute one.
The one thing that will trip you $\alpha$ is $k$ squared. The theta ratio gives you $k$; square it. Forget, and everything downstream is wrong in a way you will not notice for a while.

This is an old trap, not a modern one. Ramanujan's second letter to Hardy gives a value labelled $k_{210}$ which, when you actually evaluate it, is $\alpha_{210}$ — the square of what it says. That one is still unresolved. Write down which one you mean.

9 · What nobody here can tell you

Go back to the formula one last time. We have now accounted for almost everything in it.

NumberWhere it came from
9801$99^2$ — the whole-number part of $\varepsilon^6$
396$4\times 99$ — handed over by the dial at $N = 58$
19602$2\times 99^2$ — exact, because Pell closes
1103, 26390no idea

Those last two do not reduce to 99. Nothing in this chapter produces them. They fall out of the general theorem, which this project has tested at exactly one point and never written out in full. OPEN

Two smaller honesties. Step 4 of the recipe tells you when you have failed, not when you will succeed. And none of this proves the series converges to $1/\pi$ — it is checked to 104 digits, which is excellent evidence and is not a proof.

10 · Where to go next