예제 #1
0
	def test_small_mersenne_composites(self):
		# powers must be prime!
		powers = [11, 29, 37, 41, 43, 47, 53, 59]
		for p in powers:
			self.assertFalse(cp.lucas_lehmer(p), "failed with power={}".format(p))
예제 #2
0
	def test_nonprime_powers_raise_ValueError(self):
		# These are all composite
		powers = [4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, 30]
		for p in powers:
			with self.assertRaises(ValueError):
				cp.lucas_lehmer(p)
예제 #3
0
	def test_small_mersenne_primes(self):
		# power must be prime!
		powers = [2, 3, 5, 7, 13, 17, 19, 31]
		for p in powers:
			self.assertTrue(cp.lucas_lehmer(p), "failed with power={}".format(p))