Created
December 5, 2020 22:02
-
-
Save collinalexbell/e7bfa6e4b13e09df37a0e80ac2164d20 to your computer and use it in GitHub Desktop.
taocp, p8, euclids algo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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