Created
January 16, 2010 10:30
-
-
Save yuvipanda/278775 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
import math | |
def is_prime(n): | |
for i in range(2, int(math.sqrt(n)) + 1): | |
if n % i == 0: | |
return False | |
return True | |
cur_no = 1 | |
count = 0 | |
while count < 10001: | |
cur_no += 1 | |
if is_prime(cur_no): | |
count += 1 | |
print cur_no | |
print "10001th prime is", cur_no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment