def test_gcd_so(self): A = PolynomialModP([1, 0, 1, 0, 1], 2) B = PolynomialModP([1, 1, 1, 1], 2) g, x, y = A.gcd(B) self.assertEqual(g, 1) self.assertEqual(x * A + y * B, g)
def test_1_1c(self): A = PolynomialModP([1, -1, 1], 3) B = PolynomialModP([1, 0, 1, 2], 3) g, x, y = A.gcd(B) self.assertEqual(g, PolynomialModP([1, -2], 3)) self.assertEqual(x * A + y * B, g)
def test_1_8(self): A = PolynomialModP([1, -1], 7) B = PolynomialModP([1, 1, 1], 7) g, x, y = A.gcd(B) self.assertEqual(g, PolynomialModP([3], 7)) self.assertEqual(x * A + y * B, g)
def test_1_1b(self): A = PolynomialModP([1, 0, 1], 2) B = PolynomialModP([1, 0, 0, 1], 2) g, x, y = A.gcd(B) self.assertEqual(g, PolynomialModP([1, 1], 2)) self.assertEqual(x * A + y * B, g)