前六个质数是2,3,5,7,11和13,其中第6个是13.

第10001个质数是多少?

import math
def prime(n):
    m=int(math.sqrt(n))+1
    for i in range(2,m):
        if n%i==0:
            return False
    return True
count=0
i=2
while count<10001:
    if prime(i):
        count=count+1
    if count!=10001:
        i=i+1
print(i)

相关文章:

  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-02-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-06-17
  • 2022-12-23
  • 2022-02-08
  • 2021-10-14
相关资源
相似解决方案