Recently I've been fooling around with some fun mathmatic (dont knwo if that is even a word) stuff. I recently took on the task of trying to calcualte PI.

I have a very simple program in python that does this for me:

```
import math
from datetime import datetime
top = 4
bot = 1
pi = 0
op = '+'
starttime = datetime.now()
for x in range(1000000000):
if op == '-':
pi = pi - (top / bot)
op = '+'
else:
pi = pi + (top / bot)
op = '-'
bot = bot + 2
timefinish = datetime.now()
print("Time it took to calculate: ", timefinish - starttime)
print("{0} | {1}".format(math.pi, pi))
```

Like I said, very simple.

My computer gave the folowing results:`Time: 0:04:35.069303`

`My PI value = 3.1415926525880504`

`Real PI value = 3.141592653589793`

As we can see this is a rather lengthy task. At the moment my PI is also not too acurate. It is only accurate to 11 decimal digit. The accuracy of my PI is increased if I increase the amount of times the loop executes.

(I think I might need to go and get my IBM BLUEGENE if I want to calculate PI to 1 000 000 decimal digits.)

Do you guys know of any more efficient / accurate ways that I can calculate PI?

Feel free to post your own improved methods etc...

*Edited 2 Years Ago by MasterHacker110*