This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This algorithm is based on an unproven conjecture but successfully produces at least the first 1 million digits. | |
Read more about it here: https://www.gavalas.dev/blog/spigot-algorithms-for-pi-in-python/ | |
""" | |
def gospers_pi_unproven(): | |
q,r,t,i = 1, 180, 60, 2 | |
while True: | |
u,y = 3*(3*i+1)*(3*i+2), (q*(27*i-12)+5*r)//(5*t) | |
yield y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This algorithm is based on an unproven conjecture but successfully produces at least the first 600 thousand digits. | |
Read more about it here: https://www.gavalas.dev/blog/spigot-algorithms-for-pi-in-python/ | |
""" | |
def gospers_tau_unproven(): | |
q,r,t,i = 1, 180, 30, 2 | |
while True: | |
u,y = 3*(3*i+1)*(3*i+2), (q*(27*i-12)+5*r)//(5*t) | |
yield y |