def gcd(a, b):
    """Compute the greatest common divisor of a and b"""
    r = a % b # Remainder
    if r == 0: # if remainder is 0, then b is the GCM
        return b
    else: # if remainder is not 0, divide b by the remainder 
        a = b
        b = r
        return gcd(a, b)