Calculating Pi

Some surprising approaches to calculating Pi

Chris Laffra
7 min readMar 11, 2020
Calculating Pi using 5 Pizza Pies.

Each year on March 14, we celebrate Pi Day at Uber Amsterdam. This year, we were planning to celebrate Pi Day on Friday and to look at a couple of algorithms using PyAlgoViz. Due to COVID-19, the in-person celebration of Pi-Day got canceled, and instead we did a video call with the whole Amsterdam Tech Team at Uber Amsterdam. We did do a few live runs on one estimation, and the results can be found below.

In 2006, Akira Haraguchi recited 100,000 digits of Pi from memory, taking him 16 hours. How many can you recite?

In this article, I will show different ways of calculating Pi, with visualizations.

Archimedes’s Approximation

Approximating Pi by estimating the circumference of a circle. See PyAlgoViz.

The first algorithm predates computers and is based on a thousand of years old insight that the ratio of the diameter and circumference of a circle appear to be constant, namely C=2πr. Old estimations derived a value for Pi of 3, or 256/81 (= 3.1604…), and that was fine for a long time.

In 1850, William Shanks took 15 years to estimate Pi to 707 digits. Turns out he made an error at digit 527. Makes all the time…

--

--

Chris Laffra

{ country: “Holland”, mission: “Make other engineers impactful”, jobs: [“IBM”, “MS”, “BAML”, “GOOG”, “UBER”, “JPMC”], site: “chrislaffra.com” }