Esempio n. 1
0
 def test_600851475143(self):
     # Some large number with weird prime factors.  Known values taken from
     # wolfram alpha result (assuming WA is correct).
     self.assertListEqual(
         factors.prime_factors(600851475143),
         [71, 839, 1471, 6857]
     )
Esempio n. 2
0
 def test_26345(self):
     # Tests when trailing "remaining" value is not 1 because a prime was
     # greater than the square-root of N.
     self.assertListEqual(
         factors.prime_factors(26345),
         [5, 11, 479]
     )
Esempio n. 3
0
 def test_8(self):
     self.assertListEqual(
         factors.prime_factors(8),
         [2, 2, 2]
     )
Esempio n. 4
0
 def test_2(self):
     # If the N requested is itself a prime value
     self.assertListEqual(
         factors.prime_factors(2),
         [2]
     )
Esempio n. 5
0
 def test_2(self):
     # If the N requested is itself a prime value
     self.assertListEqual(factors.prime_factors(2), [2])
Esempio n. 6
0
 def test_600851475143(self):
     # Some large number with weird prime factors.  Known values taken from
     # wolfram alpha result (assuming WA is correct).
     self.assertListEqual(factors.prime_factors(600851475143),
                          [71, 839, 1471, 6857])
Esempio n. 7
0
 def test_26345(self):
     # Tests when trailing "remaining" value is not 1 because a prime was
     # greater than the square-root of N.
     self.assertListEqual(factors.prime_factors(26345), [5, 11, 479])
Esempio n. 8
0
 def test_8(self):
     self.assertListEqual(factors.prime_factors(8), [2, 2, 2])