add function which finds the greatest common divisor of two BigInts
This commit is contained in:
parent
2a1294f1c0
commit
d8c9f22d97
@ -1263,6 +1263,18 @@ class Utils {
|
|||||||
return Utils.gcd(y, x % y);
|
return Utils.gcd(y, x % y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the greatest common divisor of two BigInt numbers.
|
||||||
|
*
|
||||||
|
* @author atsiv1 [atsiv1@proton.me]
|
||||||
|
* @param {BigInt} x
|
||||||
|
* @param {BigInt} y
|
||||||
|
* @returns {BigInt}
|
||||||
|
*/
|
||||||
|
static gcdBigInt(a, b) {
|
||||||
|
return b === 0n ? a : Utils.gcdBigInt(b, a % b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the modular inverse of two values.
|
* Finds the modular inverse of two values.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user