greatestCommonDivisorOfMany function
Returns the greatest common divisor (gcd) of the input integers using Euclid's algorithm.
Implementation
int greatestCommonDivisorOfMany(List<int> integers) {
if (integers.isEmpty) {
return 0;
}
int gcd = integers[0].abs();
for (int i = 1; (i < integers.length) && (gcd > 1); i++) {
gcd = greatestCommonDivisor(gcd, integers[i]);
}
return gcd;
}