UNPKG

gcd

Version:

compute the greatest common divisor using euclid's algorithm

10 lines (8 loc) 220 B
var test = require('tape'); var gcd = require('../'); test('sanity values ripped from wikipedia', function (t) { t.equal(gcd(48, 18), 6); t.equal(gcd(54, 24), 6); t.equal(gcd(48, 180), 12); t.end(); });