Created
June 8, 2018 01:29
-
-
Save hzshang/4e4461796a4309375c1be116a6dde46a to your computer and use it in GitHub Desktop.
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 extend_gcd(a,b): | |
if b==0: | |
return a,1,0 | |
else: | |
g,s,t=extend_gcd(b,a%b) | |
return g,t,s-a/b*t | |
def reverse(a,N): | |
return extend_gcd(a,N)[1] | |
print reverse(5,7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment