The Pi Day Recipe Book

ten delicious and easy formulas for pi that you can try at home


We begin with perhaps history’s most elegant formula for π: this groovy little jam from Calculus cofounder Gottfried Leibniz. (Credit also goes to Scottish sensation James Gregory, who discovered this formula independently.)

Just look at these lovely unit fractions, swaying back and forth, an alternating sequence as lulling and seductive as Marvin Gaye’s best.

Like most of the recipes that follow, this one is an infinite series. The longer you go, the closer you get to π (or, in this case, π/4). If you ever stop, you won’t quite have π, just an approximation. The further you go, the better the approximation.

Take note, though: “slow” means slow. Even after 600 terms, you still won’t quite have pinned down the second decimal place as 3.14 instead of 3.13. Because it takes so long to converge, Gottfried’s Slow Jam is not very computational useful.

But damn, is it musical.


This infinite product comes not from the biblical Noah, but John Wallis (who famously unmasked the mathematical pretensions of the philosopher Thomas Hobbes).

I love the tidiness of this one: even pairs in the top, odd pairs in the bottom. The more you multiply, the closer you get to π/2.

Careful about rearranging the factors to make things easier, though. I learned that lesson the hard way.


Arguably the most important formula in this recipe book, it answered the famous Basel problem: what do you get if you add up all the reciprocals of the square numbers? First appearing in 1644, the sword remained stuck in that stone for nearly a century, until the legendary Leonhard Euler proved himself a worthy king by furnishing the unlikely answer:

Those numbers add up to π2/6.


This hard-to-follow recipe comes from the Indian savant Ramanujan, known for his humble origins and his cosmic intuition.

This formula is undeniably ugly. It throws together big, weird, seemingly arbitrary numbers. But just as undeniable is its power. It is the precise opposite of Gottfried’s Slow Jam: lacking in elegance, but astounding in its speed.

After just the first term (1103) we already have π accurate to the seventh decimal place: 3.1415927. Add in another two terms, and we’re at the 20th decimal place.

Ugly, but fast.


Now, mathematics is full of alternating series, ones that switch from positive to negative, positive to negative….  But what I love about this particular formula is that it’s a two-step alternation: positive, positive, negative, negative, positive, positive, negative, negative…

It reminds me of a drunkard staggering this way and that way across a dance-floor, intoxicated half by music and half by drink. While everyone else dances to Gottfried’s Slow Jam, our lone drunkard enjoys the Tequila Two-Step – and that’s a beautiful thing in its own right.


I’ll let you look up Hedwig and the Angry Inch, and decide for yourself whether this is brilliantly apt metaphor, or a reference far too mature for this blog’s innocent, doe-eyed audience. (Maybe both?)


Arriving on the scene in 1593 courtesy of François Viète, this wasn’t just the first great formula for π. It was the first infinite product in the history of mathematics.

A rambling equation full of 1/2’s and nested square roots, it was more elegant in its original form (which produced a product of 2/π); here, it has been mangled somewhat so that it produces a value of π itself.

(Postscript: I chose “The Halfman Cometh” for the cool sound of the name alone. But I just looked up the “The Iceman Cometh” and gosh, does that play sound depressing. This post was supposed to be about math, and somehow it has turned into a grim tour of the deepest valleys of the human psyche – which I guess maybe isn’t so different.)


First generated by John Machin in 1706, this monstrously efficient formula earned a whole genre of copycats.

Like the Ugly Ninja, it allows us to compute π to astonishing precision, in a surprisingly small number of terms.


This tower is what mathematician’s call a continued fraction.

Although now marginalized (or omitted entirely) from the school curriculum, continued fractions have long been mathematically important objects. Just ask Evelyn Lamb, who has written fondly on the topic.

They’re a lot harder to wrap your head around than decimals. But they’re also a lot more powerful, allowing for swift and succinct approximation of any irrational number.


We conclude with perhaps the zaniest of all these zany formulas.

π, from the primes.

There’s a flavor of mathematics that I love. You taste it when two utterly separate fields of inquiry, against all odds, lead to the same destination. It’s like finding a wormhole through spacetime, a secret passage between distant rooms in the mansion of thought.

This formula is one of the most concentrated doses of that flavor that you’ll find anywhere. How could the prime numbers – jagged, here-and-there creatures, almost pattern-less in their unpredictable distribution – produce π?

(Something about gamma functions, apparently. But never let a gamma function quell your sense of mystery and awe.)

Happy π day!



13 thoughts on “The Pi Day Recipe Book

  1. Very nice!

    The first formula, which you called Gottfried’s Slow Jam because of its discovery by Leibniz (1646–1716), was also discovered independently not only by James Gregory (1638–1675), but also, even a couple of centuries earlier, by Madhava (1340–1425), as known through the works of Nilakantha (1444–1544). An article by Ranjay Roy called “The Discovery of the Series Formula for π by Leibniz, Gregory and Nilakantha” (available at shows how these three people arrived at the formula independently, working in completely different mathematical traditions, with different background of what was known, different goals, different cultures of proof, and different writing styles. This remarkable mathematical convergence is part of the beauty of mathematics, that it is the same everywhere. (As pointed out by Lindsay Lohan in Mean Girls.)

  2. For “Primageddon” you can also credit Euler. In the tradition of Fermat, I don’t have enough room to prove it here.

    But, Euler showed that:

    zeta (s) = product 1/(1-p^s)

    • Maybe not rigorous, but the idea is you rewrite 1/(1-p^s) as an infinite geometric series and then expand the infinite product of infinite geometric series. It’s the same idea used in Euler’s proof of the infinitude of primes.

      • An infinite product…
        Euler’s proof of infinite primes (and the Riemann hypothesis) indeed uses this principle. For the proof of infinite primes.

        product p/(p-1) = the harmonic series.

        the harmonic series is infinite. Therefore the product on the left is infinite, therefore there are infinitely many primes.

  3. Pingback: The same in every country | The Lumber Room

  4. Absolutely brilliant, Ben!
    I have a question, good sir. I’m a huge fan of the blog and feel both students and teachers can learn a lot from the experiences and stories you share. With your permission, I would like to use your blogs as a tool in my math classroom to develop not just reading skills but reflective skills so that students can better understand why they are learning such a crazy thing like math.

  5. This almost reminds me of the website Khan academy, it holds one section all about maths and it’s called doodling in math, it’s really interesting and you should have a look at it.

  6. Pingback: The Pi Day Recipe Book | THE HAMILTON PUBLICITY

  7. You forgot the fastest converging one:

    π = π + 0 + 0 + 0 + 0 + 0 …

    After just one term you have all the digits of π.

  8. Patterns, patterns, patterns. I’ma go ogle some fractals right now; seems the thing to do for *some reason*; then I’m gonna hijack one and post it on my WordPress. And I’ll even do it the ethical way. You know “Blah der ah I claim no rights to this image Ber ah dooo weep weep but I like oer”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s