Skip to content

Instantly share code, notes, and snippets.

@tripplyons
Created October 27, 2025 22:41
Show Gist options
  • Select an option

  • Save tripplyons/ff3d3b1c2313276eaf620e800559dc0b to your computer and use it in GitHub Desktop.

Select an option

Save tripplyons/ff3d3b1c2313276eaf620e800559dc0b to your computer and use it in GitHub Desktop.
# 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
q,r,t,i = 10*q*i*(2*i-1),10*u*(q*(5*i-2)+r-y*t),t*u,i+1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment