xen-dev-utils
    Preparing search index...

    Function extendedEuclid

    • Extended Euclidean algorithm for integers a and b: Find x and y such that ax + by = gcd(a, b).

      result.gcd = a * result.coefA + b * result.coefB;  // = gcd(a, b)
      result.quotientA = div(a, gcd(a, b));
      result.quotientB = div(b, gcd(a, b));

      Parameters

      • a: number

        The first integer.

      • b: number

        The second integer.

      Returns ExtendedEuclid

      Bézout coefficients, gcd and quotients.