Skip to content

Instantly share code, notes, and snippets.

@BedirYilmaz
Created October 18, 2016 10:58
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 BedirYilmaz/dae3397ad02004b73fcd7de9609b0c95 to your computer and use it in GitHub Desktop.
Save BedirYilmaz/dae3397ad02004b73fcd7de9609b0c95 to your computer and use it in GitHub Desktop.
Find out what the 10 001st prime number is.
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