Skip to content

Instantly share code, notes, and snippets.

@dmitric
Created March 18, 2011 04:51
Show Gist options
  • Save dmitric/875633 to your computer and use it in GitHub Desktop.
Save dmitric/875633 to your computer and use it in GitHub Desktop.
def nth_prime(n):
i = 2
prime_count = 0
while True:
if is_prime(i):
if prime_count == n:
return i
prime_count += 1
if i == 2:
i += 1
else:
i += 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment