gcd
with the value of the first element in the array.gcd
to be the GCD of gcd
and the current element.gcd
becomes 1, return True
as we can form a linear combination that equals 1.gcd
is still 1, return True
.gcd
is not 1, return False
as it is not possible to form a linear combination that equals 1.