here2share

# pi_spigot.py

May 21st, 2025
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. # pi_spigot.py
  2.  
  3. def pi_spigot():
  4.     q, r, t, j = 1, 180, 60, 2
  5.     while True:
  6.         u, y = 3*(3*j+1)*(3*j+2), (q*(27*j-12)+5*r)//(5*t)
  7.         print(y)
  8.         q, r, t, j = 10*q*j*(2*j-1), 10*u*(q*(5*j-2)+r-y*t), t*u, j+1
  9.  
  10. pi_spigot()
Add Comment
Please, Sign In to add comment