Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Calculates Riemann's Zeta(3)
- # which is also Apery's constant
- # using original slow 1+1/2^3+1/3^3+...
- # Juhani Kaukoranta 24.6.2018
- from decimal import *
- import math
- import time
- def Zeta3(precision):
- getcontext().prec=precision
- r = Decimal(0)
- for n in range(1,10000*precision):
- r = r+Decimal(1)/(n*n*n)
- return(r)
- precision = int(input("How many numbers precision, f.eq 100 "))
- time0 = time.clock()
- print("Apery constant , Zeta(3) = ",Zeta3(precision))
- time1 = time.clock()
- print("calculation time ",time1-time0," seconds")
Advertisement
Add Comment
Please, Sign In to add comment