def is_prime(N, primes):
for p in primes:
if p * p > N:
return True
if N % p is 0:
return False
return True
primes = [2, 3, 5, 7]
query = 11
while len(primes) < 10001:
if is_prime(query, primes):
primes.append(query)
query += 2
print(primes[-1])
Created
February 7, 2015 13:55
-
-
Save amoshyc/b4ffcb08f04c397ab41b to your computer and use it in GitHub Desktop.
Project Euler #7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment