fork(1) download
  1. import math
  2. term = 1
  3. sum = 1103
  4. k = 1
  5. while term > 1e-15:
  6. frac0 = 1
  7. frac4 = 1
  8. for i in range (k):
  9. frac0 *= (i+1)
  10. for j in range (4*k):
  11. frac4 *= (j+1)
  12. term = (frac4*(1103+26390*k))/((frac0**4)*(396**(4*k)))
  13. sum += term
  14. k+=1
  15. p = 1/(2*math.sqrt(2)*sum/9801)
  16. print (p)
Success #stdin #stdout 0.01s 7220KB
stdin
Standard input is empty
stdout
3.14159273001