By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
What is the 10 001st prime number?
_________________________________________________________________________________
def prime(n):
if n==1:
return False
else:
i=2
k = 1 + math.floor(math.sqrt(n))
while i<k and n%i != 0:
i = i+1
if i == k:
return True
else:
return False
j=2
i=1
while i<10002:
if prime(j) == True:
i=i+1
j=j+1
print j-1
No comments:
Post a Comment