Check out this video on GCD. I have embedded it below.
Here is the code for gcd.py
.
def gcd(a,b):
if a == 0 and b == 0:
raise ValueError
if a < 0:
a = -a
if b < 0:
b = -b
while b%a > 0:
b, a = a, b%a
return a
if __name__ == "__main__":
print(gcd(7776, 1048576))
print(gcd(95238908341908231432498324980875, 34904249809812494329625))