ExtendedGCD[n, m] gives the extended greatest common divisor of the integers n and m.
Integer mathematical function (see Section A.3.10).
ExtendedGCD[n, m] returns the list g, r, s, where g is GCD[n, m], and r and s satisfy the relation . See The Mathematica Book on the web: Section 3.2.4. See also: GCD.