Skip to content
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.