Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
def denom(x):
    """
	P.48
	"""
    g = cp1.gcd(x[0], x[1])
    return x[1] / g
Exemplo n.º 4
0
def numer(x):
    """
	P.48
	"""
    g = cp1.gcd(x[0], x[1])
    return x[0] / g