SharedEuclidean Algorithm.sagewsOpen in CoCalc
def gcdEA(a,b):
    """
    This function returns the Greatest Common Divisor of a and b.
    """
    x=abs(a)
    y=abs(b)
    while (y>0):
        r = mod(x,y)
        x = y
        y = r
        print (x,y)
    return x
x=242908624
y=101
gcdEA(x,y)
(101, 89) (89, 12) (12, 5) (5, 2) (2, 1) (1, 0) 1
gcd(22*52,7)
gcdEA(22*52,7)
1 (7, 3) (3, 1) (1, 0) 1
xgcd(512,251)
(1, -25, 51)
512*-25+251*51
1