def calc(): i = 1 primes = set() twiceSquares = frozenset([2 * (j**2) for j in range(1, 100)]) while True: if isPrime(i): primes.add(i) elif i > 33: # (composite.) if all((i - j) not in primes for j in twiceSquares if j < i): print(i) return i += 2
import isprime as isp a = int(input("Entrer le premier nombre entier positif : ")) b = int(input("Entrer le deuxieme nombre entier positif : ")) isp.isPrime(a, b)
def hundred_primes(): return str(isPrime(10))
def get_first_n_primes(n): return str(isPrime(n))
def test_one_is_not_prime(self): self.assertFalse(isprime.isPrime(1))
def test_if_list_exists(self): """Sure check to ensure the list with the prime numbers exists""" test3 = isPrime(5) self.assertIsNotNone(test3)
def test_if_number_input_is_what_is_gotten(self): """if i want the first 15 numbers do i get 10 numbers is my list""" test2 = isPrime(15) self.assertEqual(len(test2),15)
def test_2_is_always_part_of_result(self): test5 = isPrime(5) self.assertIn(test5,2)
def test_three_is_prime(self): self.assertTrue(isprime.isPrime(3))
def test_if_result_is_string(self): """Checking if the result submitted is a string""" test1 = isPrime(10) self.assertEqual(type(test1), list)
def test_2_is_always_part_of_result(self): test5 = isPrime(5) self.assertIn(test5, 2)
def test_if_list_exists_when_zero_passed(self): """This test should be failed because no argument is passed thus in application""" test4 = isPrime() self.assertIsNone(test4)
def test_four_is_not_prime(self): self.assertFalse(isprime.isPrime(4))
def test_if_result_is_string(self): """Checking if the result submitted is a string""" test1 = isPrime(10) self.assertEqual(type(test1),list)
def test_fifteen_is_not_prime(self): self.assertFalse(isprime.isPrime(15))
def test_two_is_prime(self): self.assertTrue(isprime.isPrime(2))
def test_if_number_input_is_what_is_gotten(self): """if i want the first 15 numbers do i get 10 numbers is my list""" test2 = isPrime(15) self.assertEqual(len(test2), 15)