def test_correctless_large_number(self): k=500 while(1): n = HDTNBrute.computeTriangularNumber(k) factors = HDTNBrute.factorize(n) if len(factors) > 500: break k += 1 self.assertEquals(HDTNBrute.computeTriangularNumber(k), 76576500)
def test_correctless_small_number(self): self.assertEqual(HDTNBrute.search(4)[0], 6)
def test_factorize(self): for i in range(1,30): n = HDTNBrute.computeTriangularNumber(i) print("{0:2d}|{1:5d}|{2}".format(i, n, HDTNBrute.factorize(n)))