Skip to content

Instantly share code, notes, and snippets.

@collinalexbell
Created December 5, 2020 22:02
Show Gist options
  • Save collinalexbell/e7bfa6e4b13e09df37a0e80ac2164d20 to your computer and use it in GitHub Desktop.
Save collinalexbell/e7bfa6e4b13e09df37a0e80ac2164d20 to your computer and use it in GitHub Desktop.
taocp, p8, euclids algo
def f(m, n, r=0, step=1):
if(step == 1):
return f(m,n,m%n,2)
if(step == 2):
if(r == 0):
return n
else:
return f(m,n,r,3)
if(step == 3):
# r is techically p
return f(n,r,r,1)
print(f(119, 544))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment