def gcd(*numbers): """ Get a greatest common divisor for a list of numbers """ n = numbers[0] for i in numbers: n = pygcd(n, i) return n
def gcd(*numbers): """ Returns the greatest common divisor for a sequence of numbers. Args: \*numbers: Sequence of numbers. Returns: (int) Greatest common divisor of numbers. """ n = numbers[0] for i in numbers: n = pygcd(n, i) return n
def test_gcd_random_large(self): """Test the gcd function using random integers until 1 billion.""" m = randint(1, 1000000000) n = randint(1, 1000000000) GCD = gcd_recursive(m, n) self.assertEqual(GCD, pygcd(m, n))
def test_gcd_random_small(self): """Test the gcd function using random integers until 1000.""" m = randint(1, 1000) n = randint(1, 1000) GCD = gcd2(m, n) self.assertEqual(GCD, pygcd(m, n))