def test_gcd_book_example(self): """Test the gcd function using the example from the book: `m` = 608 `n` = 133 """ GCD = gcd(608, 133) self.assertEqual(GCD, 19)
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(m, n) self.assertEqual(GCD, pygcd(m, n))
def denom(x): """ P.48 """ g = cp1.gcd(x[0], x[1]) return x[1] / g
def numer(x): """ P.48 """ g = cp1.gcd(x[0], x[1]) return x[0] / g