Created
October 18, 2016 10:58
-
-
Save BedirYilmaz/dae3397ad02004b73fcd7de9609b0c95 to your computer and use it in GitHub Desktop.
Find out what the 10 001st prime number is.
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 primer(n): | |
notprime = False | |
primecount = 0 | |
x = 2 | |
while True: | |
for y in range (2, x): | |
if x%y == 0: | |
notprime = True | |
break | |
if notprime == False: | |
print(str(x) + " is prime") | |
primecount+=1 | |
notprime = False | |
if(primecount == n): | |
print(str(x) + " is 'the' prime.") | |
break | |
x+=1 | |
primer(30031) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment