Skip to content

Instantly share code, notes, and snippets.

View Nikorasu's full-sized avatar
:atom:
..coding..

Nik Nikorasu

:atom:
..coding..
View GitHub Profile
@Nikorasu
Nikorasu / tauG3.py
Created August 24, 2022 14:55 — forked from GavalasDev/tauG3.py
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
@Nikorasu
Nikorasu / piG3.py
Created August 17, 2022 17:02 — forked from GavalasDev/piG3.py
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