Exemple #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))
Exemple #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)
Exemple #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))