Skip to content

Instantly share code, notes, and snippets.

@soimort
Created March 5, 2012 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soimort/1980620 to your computer and use it in GitHub Desktop.
Save soimort/1980620 to your computer and use it in GitHub Desktop.
Project Euler - Problem 7
def prime(n):
primes = [2]
for k in range(1, n):
i = primes[k - 1]
isPrime = False
while not isPrime:
i += 1
isPrime = True
for j in range(0, k):
if i % primes[j] == 0:
isPrime = False
break
primes.append(i)
return primes[n - 1]
print(prime(10001))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment