def extended_gcd_recursive(a, b): if (a % b) == 0: return (0, 1) else: tmp = extended_gcd(b, a % b) x = tmp[0] y = tmp[2] return (y, x - y * (a / b))