Skip to content

Instantly share code, notes, and snippets.

View Pengeszikra's full-sized avatar

Peter Vivo Pengeszikra

View GitHub Profile
@thebecwar
thebecwar / chudnovsky.py
Created March 18, 2018 03:56
Chudnovsky Algorithm in Python
import decimal
# for reference, the first 100 digits of pi
pi = decimal.Decimal('3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679')
# Basic recursive factorial calculation. For large n switch to iterative.
def fact(n):
if n == 0:
return 1