1.0.0 • Published 5 years ago

extgcd v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

extgcd

Compute the gcd and solve Bezout's identity using the extended Euclidean algorithm.

#usage

var extgcd = require('extgcd');
console.log(extgcd(56, 15));

/**
 * Will output gcd, x and y such that 56x + 15y = gcd.
 * {
 *     gcd: 1,
 *     x: -4,
 *     y: 15
 * }
 */

#methods

##extgcd(a, b)

Returns an object containing the gcd, and the solution (x, y) to Bezout's identity.

{
    gcd: gcd,
    x: x,
    y: y
}