from addit import timeit, printit, threadit, processit def isprime(number, primelist): """ checks if a number is prime by finding dividing it by every other prime below floor(number / 2) """ for prime in primelist: if prime <= number // 2 and number % prime == 0: return False return True @processit @printit @timeit def findprimesto(primecap): """ finds numprimes count of prime numbers """ primelist = [2] testnum = 3 while testnum < primecap: if isprime(testnum, primelist): primelist.append(testnum) testnum += 2 return primelist @processit @printit @timeit def findxprimes(x): """ finds numprimes count of prime numbers """ primelist = [2] testnum = 3 while len(primelist) < x: if isprime(testnum, primelist): primelist.append(testnum) testnum += 2 return primelist @timeit def runner(): findxprimes(10000) findxprimes(10000) runner() findprimesto(1000) findprimesto(1000)