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

Find the greatest common divisor of numbers.

Similar: gcd, lcm.


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

const {gcd} = require('extra-number');


gcd(6, 15);
// → 3

gcd(6, 15, 21);
// → 3

gcd(6, 15, 20);
// → 1


References

Clone this wiki locally