Table of Contents
Pi is the number you get when you take any circle, measure the distance around it, and divide by the distance across it. Any circle. A dinner plate, the moon, a ring you draw in the sand. Always the same number. About 3.14159, and then it keeps going forever without repeating.
That last part is the part that gets people. It never ends. It never settles into a pattern. You can compute a trillion digits and you are no closer to the “end” than when you started, because there is no end. Pi is irrational (you can’t write it as a fraction) and transcendental (it isn’t the root of any nice polynomial), which are two math-flavored ways of saying it refuses to be pinned down.
And here’s the part that actually keeps me up at night. Pi shows up in places that have nothing to do with circles. Add up 1 + 1/4 + 1/9 + 1/16 forever (just the square numbers, flipped over) and you get pi squared over six. No circle in sight. It’s in probability, in waves, in quantum mechanics, in the way a river bends. It’s like the universe has this one number tattooed on the inside of everything and every so often you catch a glimpse of it.
People care about pi because it’s the first genuinely infinite thing most of us ever meet. And some of us never really leave.

The pi guys
Before we get into four thousand years of math, a local note.
If you were in Olympia in the early 2000s and you went to Arts Walk, you might have seen digits of pi chalked down the sidewalk, written out by people in radiation suits. That was us. I was one of the pi guys. We’d write it out block after block and people liked it (it’s a good bit, honestly). I’m not going to explain it more than that. If you know, you know.
Okay. Now the history.
Era 1: measuring (the string-around-a-circle days)
The oldest way to find pi is to just go measure it. Wrap a string around something round, then lay the string next to the diameter and see how many times it fits. A little over three. Everyone who ever did this got a little over three.
The Babylonians used 25/8, which is 3.125. The Egyptians did better. In the Rhind papyrus (around 1650 BC) they used (16/9) squared, which comes out to about 3.16. These people had no decimal point, no algebra, no idea pi was irrational. They just needed to build things that were round and not fall down, and this was close enough.

Era 2: geometry (trapping pi between shapes)
Then Archimedes had the first real idea, around 250 BC, and it’s so good it’s still the first thing you’d think of.
You can’t measure a circle exactly. Fine. But you can draw a polygon inside the circle and another one outside it. The circle is squeezed between them. A hexagon is a rough guess. But you can double the sides. Twelve sides, twenty four, forty eight, ninety six. The more sides, the tighter the squeeze, and pi has nowhere to hide.

Archimedes did this by hand up to 96 sides and proved pi was between 3 10/71 and 3 1/7. That’s not an estimate. That’s a proof, with a floor and a ceiling, 2000 years before calculus.
Then a Chinese astronomer named Zu Chongzhi took the exact same method and pushed it to a 12,288-sided polygon (by hand, think about that for a second) and landed on 355/113. That fraction is correct to six decimal places, and it held the world record for roughly 900 years. Nine hundred. Nobody beat it for almost a millennium.
Era 3: infinite series (pi becomes a sum)
Calculus changed the whole game. Pi stopped being something you measured and became something you added up. Forever. One term at a time.
The most famous one is the Madhava-Leibniz series:
$$\frac{\pi}{4} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots$$
It’s beautiful. Just the odd numbers, alternating plus and minus. And it is painfully, hilariously slow. In the notebook you can watch it grind through a hundred thousand terms to earn you a whopping five correct digits. It converges the way a glacier commutes.
So people found faster ones. Nilakantha’s series (around 1500) was quicker. Then Machin (1706) found a formula using arctangents that actually got used for real record attempts for the next 250 years:
$$\frac{\pi}{4} = 4\arctan\frac{1}{5} - \arctan\frac{1}{239}$$
Fifty terms of Machin gets you seventy-something digits. That’s the difference between a formula that converges and one that just kind of leans in the right direction and hopes.
And then there’s Euler. In 1734 he cracked a problem that had stumped everyone (the Basel problem) and found this:
$$\frac{\pi^2}{6} = 1 + \frac{1}{4} + \frac{1}{9} + \frac{1}{16} + \cdots$$
I said it up top and I’ll say it again because it’s the whole thing. There are no circles here. You add up one over each square number and pi falls out of the sky. This is the mystery. Pi is not a circle fact. Pi is a universe fact that happens to also describe circles.

Era 4: randomness and speed (the weird ones)
Two completely opposite ideas live here.
The first is unhinged and I love it. You can find pi by throwing things. Draw a quarter circle inside a square, then throw darts at random. Count how many land inside the curve versus the total. That ratio sneaks up on pi/4. Pi. From pure randomness. This is the Monte Carlo method (same spirit as Buffon’s needle from 1777, where you drop needles on a lined floor and count how many cross a line).

It’s slow (to get one more digit you need a hundred times more darts) and it will never win a race. But it works, and that it works at all is a small miracle.
The opposite idea is the Gauss-Legendre algorithm (1976). Instead of adding one small term at a time, each step roughly doubles the number of correct digits. Not adds. Doubles. Eight steps and you’ve got a hundred digits. This is the first method that feels modern and fast, and early computer records were set with it.

You read this far. Now you get the real crazy pi people.
Ramanujan
Srinivasa Ramanujan was a clerk in Madras with almost no formal math training. No PhD, no fancy schooling, mostly one old textbook. He filled notebook after notebook with formulas, thousands of them, many with no proof at all. When people asked where they came from, he said the goddess Namagiri wrote them on his tongue while he slept.

In 1914 he published this:
$$\frac{1}{\pi} = \frac{2\sqrt{2}}{9801} \sum_{k=0}^{\infty} \frac{(4k)!,(1103 + 26390k)}{(k!)^4, 396^{4k}}$$
Each term of that gives you about eight correct digits of pi. Eight. Leibniz needed a hundred thousand terms for five. And nobody could prove Ramanujan’s formula actually worked for another 73 years. It just did. He handed the world a machine and a note that said “trust me” and he was right.
So here’s the thing I keep circling. Is he crazy? Is he right? Does it matter? A guy says a goddess gave him a formula in a dream, the formula has no proof, and it turns out to be one of the most efficient ways to compute pi ever discovered. A formula that works is a formula that works, whether it came from years of rigor or from a dream you can’t explain. I don’t know where his math came from. I’m not sure he knew either. I just know it was right.
The Chudnovsky brothers
Ramanujan’s dream had heirs.
David and Gregory Chudnovsky are two brothers (I have two brothers, so this one hits me somewhere specific) who lived in New York City. They took Ramanujan’s style of formula and made it converge even faster:
$$\frac{1}{\pi} = 12 \sum_{k=0}^{\infty} \frac{(-1)^k (6k)!,(545140134k + 13591409)}{(3k)!,(k!)^3, 640320^{3k + 3/2}}$$
About fourteen correct digits per term. This is the formula behind basically every pi world record since the late 1980s. The math underneath it is deep (class field theory, the number 640320 is not random, it’s tangled up with a special value called the j-invariant), and if you want the real version it’s waiting for you in the notebook. For now just know it converges faster than almost anything humans have ever written down.
And they ran it on a supercomputer they built themselves. Mail-order parts, in a cramped Manhattan apartment, wired together by hand. They called it “m zero.” It threw off so much heat their landlord got furious. Two guys in an apartment, cooling a homemade supercomputer with fans, computing over a billion digits of pi. That’s the genius-in-plain-sight story I can’t get enough of.

(There’s no freely licensed photo of the brothers anywhere, which feels weirdly on brand for two guys who spent decades working alone. If you want to see their faces and the actual apartment full of humming boxes, go read Richard Preston’s The Mountains of Pi in The New Yorker. It’s the definitive piece and it’s where a lot of this story comes from.)
When the movie Pi came out (Aronofsky, black and white, a math guy in New York slowly losing it to a number), that was the fantasy made cinema. A mind and a machine and a number too big to hold. I ate it up.
The part where this got personal
I should tell you why I know all this.
In high school I memorized pi. I got up to about 500 digits. I did it to impress my friends, which, at that age, is as good a reason as any to do anything. Only one person ever actually witnessed the full 500: my friend Evan, during our psych class, while we were supposed to be doing something else. I did it in five-digit chunks, which had a fun side effect. Someone could read me any five digits from the middle and I could pick right up and keep going from there. Party trick inside a party trick.
I’m all washed up now (you can quote me on that). Maybe a hundred left in the tank. But I still believe anyone can memorize pi. It’s not about being a genius. It’s about dedication. It’s like a Rubik’s cube (which I can also solve in about 90 seconds). You learn the thing and you do the thing. That’s the whole tagline of this website and I mean it. But I get that it feels different from the outside if you don’t know the thing yet. From the outside it looks like magic. From the inside it’s just chunks.
Then came 2001, and the software called PiFast, and my e-Machine.
I wanted to chase the Chudnovsky brothers. Not catch them (nobody catches them) but get a sliver of the feeling. So I’d fire up PiFast and set it computing. It ran for hours. I knew it would. The thing gave you no feedback, no progress bar, no way to tell if it was still working or had quietly frozen and was mocking me. You just had to trust it and wait. So I’d chain smoke and walk up 4th Avenue in the rain and come back and it would still be going, or maybe not, no way to tell.
I’d stay up way too late. The specific memory that sticks is the sun coming through the window and realizing I had to live through the entire next day on no sleep, all for some digits. (How I got through those days is another story.) My roommate was Mark. We had broadband coming in through the heater vent from the apartment above, and I’d spend all night on Hotline pulling down files at 100k and thinking that was the fastest thing that had ever happened to anyone.
Not everything about that time was digits and glory. My first year at Evergreen, my professor wrote in my first evaluation that I should do some soul searching about whether math was really my thing. That one landed hard. Depression made it hard to focus, hard to be the person I thought I was supposed to be. I always figured I was remarkable, and here was someone gently suggesting maybe not.
I overcame it. Got the degree. Years later got a master’s. I’m not telling you that to brag. I’m telling you because if you’re a teenager right now who thinks pi is cool and also thinks maybe you’re not smart enough for the room, I have been in that exact room and the room was wrong.
One billion
Here’s where it goes fully off the rails, and where it becomes beautiful.
Forty digits of pi is enough to calculate the circumference of the entire observable universe to within the width of a single hydrogen atom. Forty. That’s it. That’s every practical use of pi, done, forever, with digits to spare.
So what are we doing computing a billion?
Once you go past a billion digits you aren’t doing it for the accuracy anymore. You’re way past what you’d need to measure the biggest possible circle in existence. The digits stop being useful and start being something else. Art, maybe. Obsession, definitely. A climb you do because the mountain is there and the mountain is infinite.
That’s the Chudnovsky brothers in their apartment. That’s me at 3am watching a frozen screen that might or might not be computing. It’s fun / it matters / it’s weird, all at once, and I feel a sliver of what they must feel and I hope I’m right about that.
Pi is where I first understood that you can love a thing for no reason anyone else would accept. Which, now that I write it down, might be the most useful thing pi ever taught me.
Go run it yourself
The blog post is the story. The notebook is the code. Every method above, actually running, showing you exactly how many digits it earns per term, up to Chudnovsky spitting out hundreds of digits in a handful of lines. If you finished this and you want to see the machine, that’s where it lives.

And if you want the other half of my feelings about math, the one about how the beauty isn’t in the grinding but in the seeing, I wrote that one too: Where Creativity Lives in Mathematics.
Now go memorize some digits. Five at a time.
Image credits
- Circle/diameter diagram, polygon squeeze, Monte Carlo darts, and the convergence chart: generated by me with matplotlib (in the notebook).
- Rhind Mathematical Papyrus: British Museum, public domain (via Wikimedia Commons).
- Leonhard Euler portrait (Jakob Emanuel Handmann): public domain (via Wikimedia Commons).
- Carl Friedrich Gauss portrait (after Christian Albrecht Jensen): public domain (via Wikimedia Commons).
- Srinivasa Ramanujan (1919 passport photograph): public domain (via Wikimedia Commons).
- Supercomputer of the era: public domain (via Wikimedia Commons).