Home > python > First 15 digits of PI

## First 15 digits of PI

Look at this verse:

```How I want a drink
alcoholic of course
After the heavy lectures
involving complex functions```

Take the length of the words and you get the first 15 digits of PI. Here is the proof:

```import sys
import math

s = """
How I want a drink
alcoholic of course
After the heavy lectures
involving complex functions
"""

print [len(w) for w in s.split()]
print math.pi
```

Output:

```[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]
3.14159265359   # the last digit is rounded here```

And if you didn’t know, here is the PI song :)

Update (20110317)

You can approximate the value of PI with 355/113. The first 6 decimal places are the same. It’s quite easy to memorize it: visualize 113355, split into two (113 and 355), then do the division.

```>>> import math
>>> math.pi
3.1415926535897931
>>> 355/113.
3.1415929203539825
```

Ref.: Kee Nethery at python-list.

Categories: python Tags: , ,
1. January 19, 2018 at 19:05

what is the importance of 9 as related to pi

• January 19, 2018 at 21:58

I don’t understand what you mean.