Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -0,0 +1,14 @@
function GCD(A) // A is an integer array (e.g. [57,0,-45,-18,90,447])
{
var n = A.length, x = A[0] < 0 ? -A[0] : A[0];
for (var i = 1; i < n; i++)
{ var y = A[i] < 0 ? -A[i] : A[i];
while (x && y){ x > y ? x %= y : y %= x; }
x += y;
}
return x;
}
/* For example:
GCD([57,0,-45,-18,90,447]) -> 3
*/