Example #1
0
    def test_euklidesEquatation(self):
        a = math.pow(2, 16) - 1
        b = math.pow(2, 16) + 1
        nwd, x, y = Modular.euklidesEquatation(a, b)

        self.assertEquals(1, nwd)
        self.assertEquals(math.pow(2, 15), x)
        self.assertEquals(-math.pow(2, 15) + 1, y)
Example #2
0
def zad_4():
    a = pow(2, 16) - 1
    b = pow(2, 16) + 1

    result1 = Modular.nwd([a, b])
    print("nwd", result1)

    result2 = pow(a, 32) * pow(b, 32)  # nwd is 1
    print("nww", result2)

    print("phi", Modular.phi_by_kanon_pow(a, b))

    nwd, x, y = Modular.euklidesEquatation(a, b)
    kanonx = Modular.kanon(x)
    kanony = Modular.kanon(y)

    print("x:", x)
    print("kanon x:", kanonx)

    print("y:", y)
    print("kanon y:", kanony)