the-honk/python/calculators/pi.py
2024-10-09 18:02:48 +01:00

12 lines
184 B
Python

import math
pi = 0
for k in range(20):
numerator = (2 ** k) * (math.factorial(k) ** 2)
denominator = math.factorial((2 * k) + 1)
pi += numerator / denominator
pi *= 2
print(pi)