Esempio n. 1
0
    def test_low_mod(self):
        m = ModularSolver(modulus=31,primitive_root=3)
        numerators = [1, 1, 1, 0, -1, 0, 1]
        denominators = [1, 2, 6, 1, 30, 1, 42]
        expected = [m.div(n, d) for n, d in izip(numerators, denominators)]
        b = Bernoulli(modulus=31, primitive_root=3)
        actual = list(b.bernoulli(6))

        self.assertEqual(expected, actual)
Esempio n. 2
0
    def test_div(self):
        m = ModularSolver(31)

        self.assertEqual(m.div(40, 2), 20)
        self.assertEqual(m.div(9, 2), 20)