标签:素数
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?
使用埃拉托斯特尼筛法,不懂得自行Wiki
我的python代码:
# -*- coding:utf-8 -*-
#使用埃拉托斯尼特晒法
#从2开始
import math
def findprime(L):
i = 0
count = 0
while L[i]**2<L[-1]:
for j in range (i+1,len(L)):
if L[j]%L[i] == 0:
L[j] = 0
count += 1
L.sort()
L = L[count:]
count = 0
i += 1
return L
L=range(2,1000000)
prime = findprime(L)
print prime[10000]欧拉项目007:第10001个素数,布布扣,bubuko.com
标签:素数
原文地址:http://blog.csdn.net/hackingwu/article/details/26599057