– How do people/computers calculate further digits of pi?



I saw recently that you would only need 39 decimals of pi to calculate the diameter of the observable universe to the margin of a single hydrogen atom. So then how in the world do people make the calculations to find more digits of pi? How did we get to so many?

In: Mathematics

One of the cool things about Pi is that it tends to pop up in unexpected places in math. It turns out that Pi can be reached by a ton of different formulae. For example, Pi = 4 – 4/3 + 4/5 – 4/7 +…

By calculating more and more terms of this series, you get values closer and closer to the actual value of pi. In practice we don’t use this series, because it takes a long time to converge (you need to add a lot of elements for each digit you want to calculate). There are other, more efficient formulae which computers use.

Historically, people used the following methods:

1) Measuring

2) Calculating the areas of many-sided polygons, using them as an approximation to a circle

3) Using a number of different formulas that expressed pi as an infinite sum or product, and just kept adding additional terms; for example, the [Leibniz formula](https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80) which is a very simple result that says 1 – 1/3 + 1/5 – 1/7 + 1/9 – … = π/4

We now have 4), an [explicit formula to compute whatever digit of pi you want without having to calculate the preceding digits](https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula)

As others have mentioned there are several infinite series for the value of pi.

With computers, it is relatively easy (from a programming viewpoint) to calculate pi to any degree required. All it requires is computing time and power. We have very powerful computers so getting pi to millions of digits isn’t very difficult even for a beginner at programming using a relatively modern computer.

FYI, we rarely _need_ all that many decimals in the real world. Even NASA is happy to use just six or so decimals for their trajectory calculations.