Pi Day 2022: Calculating Pi digit by digit with a spigot algorithm

The number π is irrational and transcendental, which means it goes on forever without repetition. Because it goes on forever, calculating a lot of its digits is a mathematical challenge.

Using some methods for calculating π mean that only approximations of its value are possible. The Monte Carlo and Infinite Series methods below are like this. The longer that the calculation goes on, then the closer to π the computer's guess is. Unfortunately, that answer is limited to the number of decimal places the computer can represent with those calculations.

So how can we calculate π to thousands and millions of digits? Many websites will list huge numbers of digits for π, so they were able to do it.

One good method for this is a Spigot Algorithm. This method calculates the digits for pi one digit at a time and spits them out in a list, like a dripping faucet. Using this program, you click the "Go!" button and calculate as many digits of π as you like! Just change the number of digits you want in the box and click the button.

This academic article A Spigot Algorithm for the Digits of Pi by Rabinowitz and Spagin was the inspiration for the program here. Search YouTube for "pi spigot algorithm" for more explanations of how this method works!

a water spigot