def getPrime(b): p = Random(b) d1 = d2 = d3 = 0 while True: d1 += 1 if PrimeTest.Preprocessor(p) == False: p += 2 continue d2 += 1 if PrimeTest.Fermat(p, 20) == False: p += 2 continue d3 += 1 if PrimeTest.Miller_Rabin(p, 20) == False: p += 2 continue break print(d1) print(d2) print(d3) return p
import PrimeTest as pr import time start = time.time() num = 0 counter = 0 while counter < 2000000: counter = counter + 1 if pr.isPrime(counter) == True: num = num + counter print(num) print(time.time()-start)
import PrimeTest as pr checker = 0 n=0 y=0 while checker == 0: n = n+1 if pr.isPrime(n) == True: y = y+1 if y == 10001: checker = checker + 1 print(n)