def getGreatestCommonDivisor(x, y):
    a=0
    if (x<y) :
        d = x
    else:
        d = y
    while ((x % d != 0) or (y % d != 0)):
        a+=1
        d = d - 1
    print("Iterations of GCD: "+str(a))
    return d


def getGreatestCommonDivisorLoops(x, y):
    a=0
    while (x != y):
        while (x>y):
            x -= y
            a+=1
        while (y>x):
            y -=x
            a+=1
    print("Iterations of GCDloop: "+str(a))
    return x



def getGreatestCommonDivisorEuclid(x, y):
    a=0
    remainder = x % y
    while (remainder != 0):
        x = y
        a+=1
        y = remainder
        remainder = x % y
    print("Iterations of GCDloop: "+str(a))
    return y


print(getGreatestCommonDivisor(51851814,5185152))
print(getGreatestCommonDivisorLoops(51851814,5185152))
print(getGreatestCommonDivisorEuclid(51851814,5185152))