Skip to content
Subhajit Sahu edited this page Feb 27, 2020 · 20 revisions

Gives greatest common divisor of numbers (aka HCF).

math.gcd(...n);
// n: a list of numbers
const math = require('extra-math');

math.gcd(6, 15);
// 3

math.gcd(6, 15, 21);
// 3

math.gcd(6, 15, 20);
// 1

references

Clone this wiki locally