N

Nilakantha

Calculate pi with Nilakantha’s series (accurate to 12 decimal places after 30,000 iterations):

#!/usr/bin/python
from decimal import *
import sys
getcontext().prec = 40
c = 0
s = Decimal(1);
pi = Decimal(3);
n = int(sys.argv[1])
for i in range(2, n * 2, 2):
    pi = pi + s * (Decimal(4) / (Decimal(i) * (Decimal(i) + 
    Decimal(1)) * (Decimal(i) + Decimal(2))))
    s = -1 * s
    c = c + 1
    print c, (pi)

A World Out of Time (Larry Niven) – A dying man who had himself frozen as a last throw of the dice is revived in the future and trained to pilot a starship terraforming distant planets for a police state. He hijacks his own ship and takes a round trip through the galactic core…

 

 

 

numwords