Skip to content

Instantly share code, notes, and snippets.

View GavalasDev's full-sized avatar

Konstantinos Gavalas GavalasDev

View GitHub Profile
@GavalasDev
GavalasDev / tauG3.py
Created August 24, 2022 11:42
A fast spigot algorithm for the digits of Tau.
"""
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
@GavalasDev
GavalasDev / piG3.py
Created May 9, 2021 09:03
A faster spigot algorithm for the digits of Pi.
"""
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.