# Calculating the nth digit of pi

This VERITAS is based on some joint knowledge hunting and discussions with Rajan a few days back.

We all know what pi is. It is defined as the ratio of the circumference of a circle(any circle) to its diameter. Pi is approximately 3.14159.

Now pi is a irrational number. That means that the digits of pi are endless and nonrepeating. So it does not stop at 3.14159 it goes on and on till infinity: 3.1415926535897932384626434….. .

Pi is everywhere. And it can be calculated by various methods. Take a simple home experiment to calculate pi:

draw 2 parallel lines on the floor a distance d apart. Take a toothpick of length l ( make sure that l < d) . Drop the toothpick between the lines n times( make this very large!) . If the toothpick touches any of the two lines k times then pi is given by : 2*l*n/k*d. This is called Buffon’s needle theorem and was proved in 1777 by Comte (Count) de Buffon.

The current world record for calculating pi stands at the ten billionth digit.

One of the chief reasons why people want to calculate pi to higher and higher decimal places is to show that pi is normal. By that it means that if you calculate pi to a very large value then each digit ( 1,2,3 etc ) should occur 1/10 times.

How do people calculate the higher digits of pi? They use the mathematical expansions of pi. Here are some examples :

PI/2 = 2/1 * 2/3 * 4/3 * 4/5 * 6/5 * 6/7 * …  ( Wallis’s Product)

PI/4 = 1/1 – 1/3 + 1/5 – 1/7 + …              ( Lebnitz’s formula)

And supercomputers are used to sum these expansions. One of the fastest known algorithms for calculating the value of pi uses Ramanujan’s formula which is based on elliptical functions.

Till a few years back it was thought that if you want to know the nth digit of pi you have to calculate all n-1 digits before that( i.e to calculate the 100th digit of pi you should first have calculated the first 99 ) . But a remarkable formula( and algorithm ) by Bailey,Borwein and Plouffe has shown us a way to calculate the nth digit without calculating any previous digit. If you want to know what this wonderful formula looks like go to this page :

http://www.mathsoft.com/asolve/plouffe/plouffe.html