Skip to content

Extended Euclidean Algorithm for Modulo Inverse #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Screenshot from 2019-06-15 20-16-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions eea.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import sys
import math
#Python script for Extended Euclidean Algorithm
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
gcd, x, y = egcd(b % a, a)
return (gcd, y - math.floor(b/a) * x, x)

def main():
if(len(sys.argv)!=3):
print("Usage: python3 eea.py a m")
print("\tax+by=1\n\tgdc(a,m)=1")
else:
a=int(sys.argv[1])
m=int(sys.argv[2])
gcd, x, y = egcd(a,m)
print("gdc:"+str(gcd)+" x:"+str(x)+" y:"+str(y))

if __name__ == "__main__":
main()
27 changes: 0 additions & 27 deletions extended-euclidean-algorithm.py

This file was deleted.