def test_small_21(): time.sleep(2) assert isPrime(21) == True
def test_small_1(): assert isPrime(1) == True
def checkCircPrime(n: list) -> bool: for nums in n: if not isPrime(nums): return False return True
def test_small_negative(): assert isPrime(-7) == True
def test_small_0(): assert isPrime(0) == False
def test_small_2(): #time.sleep(2) assert isPrime(2) == True
def test_small_1(): assert isPrime(1) == False
def test_small_21(): assert isPrime(21) == False
def test_small_big(): assert isPrime(87178291199) == True
if not new_numb1 == "": new_numbers.append(new_numb1) if not new_numb2 == "": new_numbers.append(new_numb2) return new_numbers #check if all numbers in a list are primes. def isAllPrime(j: list): for numb in j: if not isPrime(int(numb)): return False return True print(isPrime(0)) sum = 0 found = 0 for i in range(10, 1000000): print("checking for {}".format(i)) numbs = pieceOfNumb(str(i)) if isAllPrime(numbs): sum = sum + i found = found + 1 #if we have found 11 numbers we can exit the loop if found == 11: break #Print Solution out
def isAllPrime(j: list): for numb in j: if not isPrime(int(numb)): return False return True
def test_small_3(): assert isPrime(3) == True
def test_small_2(): assert isPrime(2) == True
''' By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ''' import time from Prime import isPrime count = int( input( "Enter the position of prime number you want to generate(1st, 1000th etc): " )) start = time.time() j = 0 n = 0 while (j <= count): n += 1 if (isPrime(n)): j += 1 print("The {0}th Prime Number is {1}".format(count, n)) end = time.time() print("Executed in {0:5f} ms".format((end - start) * 1000))
def test_small_2(): time.sleep(2) assert isPrime(2) == False
def test_small_big_false(): assert isPrime(87178291197) == False
def test_small_3(): time.sleep(2) assert isPrime(3) == True
def test_small_21(): #time.sleep(2) assert isPrime(21) == False