Advertisement
Peaser

euler mascheroni constant

Oct 28th, 2015
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. import math
  2. def eulermascheroni(n):
  3.     parts = range(1, n+1)
  4.     series = []
  5.     for i in parts:
  6.         series.append(1/i)
  7.     sigma = sum(series)
  8.     return sigma - math.log(n)
  9.  
  10. #try for n = 10000000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement