Created
March 18, 2011 04:51
-
-
Save dmitric/875633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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