def test_fermat(self):
     x = random.randint(1, 100000000)
     factors = fermat(x)
     res = 1
     for i in factors:
         res *= i
     self.assertEqual(x, res)
 def test_fermat(self):
     x = random.randint(1, 100000000)
     factors = fermat(x)
     res = 1
     for i in factors:
         res *= i
     self.assertEqual(x, res)
Esempio n. 3
0
def fct_operations(f_code, v):
    if f_code == 1:
        res = fermat.fermat(v)
        return res
    elif f_code == 2:
        res = pollard_rho.pollard_rho(v)
        return res
    elif f_code == 3:
        res = trial_division.trial_division(v)
        return res