title:
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?
通过列出前6个质数,我们可知第6个质数是13。
那么第10001个质数是多少呢?
解答:
import math
# 试除法
def isOk(a):
for i in range(2,int(math.sqrt(a))+1):
if a%i == 0:
return False
return True
n=0
i=2
while n<10001:
if isOk(i) :
n+=1
i += 1
print i-1