Ejemplo n.º 1
0
 def test_perfect_square_even(self):
     """
     Test k where k is even and k = n ^ 2 for some n
     """
     result = divisors.divisors(88**2)
     self.assertEqual(result, [
         1, 2, 4, 8, 11, 16, 22, 32, 44, 64, 88, 121, 176, 242, 352, 484,
         704, 968, 1936, 3872, 7744
     ])
Ejemplo n.º 2
0
 def test_perfect_square_odd(self):
     """
     Test k where k is odd and k = n ^ 2 for some n
     """
     result = divisors.divisors(147**2)
     self.assertEqual(result, [
         1, 3, 7, 9, 21, 49, 63, 147, 343, 441, 1029, 2401, 3087, 7203,
         21609
     ])
Ejemplo n.º 3
0
 def test_non_perfect_square_even(self):
     """
     Test k where k is even and k != n ^ 2 for any integer n
     """
     result = divisors.divisors(5678)
     self.assertEqual(result, [1, 2, 17, 34, 167, 334, 2839, 5678])
Ejemplo n.º 4
0
 def test_has_consequetive_factors(self):
     """
     Test a number k where n * (n + 1) = k for some n
     """
     result = divisors.divisors(12)
     self.assertEqual(result, [1, 2, 3, 4, 6, 12])
Ejemplo n.º 5
0
 def test_non_perfect_square_odd(self):
     """
     Test k where k is odd and k != n ^ 2 for any integer n
     """
     result = divisors.divisors(54321)
     self.assertEqual(result, [1, 3, 19, 57, 953, 2859, 18107, 54321])