def gcd(q, r): """Returns the greatest common divisor of q and r. """ return algorithm.extended_euclidean(q, r)[0]
def gcd_extended(q, r): """Return a tuple (p, a, b) such that p = aq + br, where p is the greatest common divisor. """ return algorithm.extended_euclidean(q, r)