def greatest_common_divisor(a, b):
    """Function to calculate the greatest common divisor"""
    while a != b:
        if a < b:
            b = b - a
        else:
            a = a - b
    return a