Skip to content
Subhajit Sahu edited this page Aug 9, 2022 · 2 revisions

Find the greatest common divisor of bigints.

Similar: gcd, lcm.


function gcd(...xs)
// xs: a list of bigints

const xbigint = require('extra-bigint');


xbigint.gcd(6n, 15n);
// → 3n

xbigint.gcd(6n, 15n, 21n);
// → 3n

xbigint.gcd(6n, 15n, 20n);
// → 1n


References

Clone this wiki locally