How many digits of Pi do you need?

Pi ( π) is a symbol representing the ratio of a circle’s circumference and its diameter. Its value is 3.14159… followed by infinitely many digits.

Approximations

A good approximation for people to memorize is 22/7

A lot of people I have encountered incorrectly think of 22/7 as another form of PI which is not true. Because 22/7 is 3.142857142857142857…

You can see that its value differs from Pi after 2 decimal places. 22/7 can be used for approximations when you don’t have calculators but don’t use it for serious calculation.

Another quick difference: 22/7 has a pattern but Pi doesn’t.

Can you notice the underlying pattern?

Exact form

You cannot write Pi in its exact form using only fractions or decimal numbers. Because of that, calculating a circle’s circumference, radius or diameter with full precision is not possible!

How to use Pi

I will demonstrate using a simple formula taught in schools:

2 * Pi * Radius= Circumference

Intuitively, it says that if you have a circle’s radius, you can turn it into a circumference and vice versa.

The catch? You can only approximate! Calculating anything with Pi is always approximations. You can have as many digits as you want for extra precision but never expect a perfect answer.

We can generate Pi with millions of digits in an instant using computers. The error of the approximations will be lesser for each digit you keep adding to it.

How many digits are needed?

But an interesting question arises, how many digits of Pi are needed for approximating any real world calculations so that the error is insignificant?

Is it a hundred, a thousand, a million, a trillion or more than that?

Turns out, it’s only 39. Or simply 40 if you like round number.

That’s the number of Pi you need to approximate the observable universe’s circumference with the error less than a diameter of a hydrogen atom.

That’s pretty low error. And it’s also not a lot of digit, is it?

Then, why do we need millions of digits?

We don’t!

These days, computers generate million or even trillion of digits of Pi to test their performance in computation only. It’s of no actual use. In other words, million digits of Pi are really useless (currently).

Except that you will use some of it as a password like me then it will be somewhat useful.

How many digits do you remember?

Most people know Pi up to 2 decimal places (3.14) because you can always refer to the internet for those extra decimal places anytime you want.

But when you are in a programming competition, you can’t lookup the internet. That’s why I try to memorize as many digits as needed because some programming problems involve memorizing Pi. You only need 7 digits at most.

3.1415926 is already enough to store in a float data type. So, I memorized that number and ask to myself, what if I want to use double data type?

I need to memorize 15 decimal places of Pi to store in double. So it made me tried to memorize this: 3.141592653589793

And it was fun for me to type it without recalling from the internet.

After that, I tried adding more digits to memorize without forcing myself. I add 5 digits at a time and it cost me 3–4 minutes a day to memorize those 5 extra digits.

Eventually, now I can memorize Pi up to 100 decimal places!

I know that it’s not so useful to memorize 100 places of Pi. But it was fun. It’s like playing a game to impress yourself.

Here is the first 100 decimal places of Pi I’m talking about:

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679…

Conclusion:

Pi is a useful number, but only up to 40 digits. The more you add to it is not so important after all. I remember Pi up to 100 digits and here is the trick:

Memorizing things over time. Don’t force your brain in one day.

Use muscle memory if possible, try typing the digits out or writing if you prefer.

I can recall these numbers best when I type. That’s why muscle memory is great for memorizing stuff.

Note: This is the first post for me to practice writing English on medium.

PS. I know there is an extraordinary person that remembers Pi up to 20,000 places but I am not going to compare with that guy. I’m not an extraordinary person.

PPS. Not to be confused with Pie that is a food. :)

Written by