首页 > 代码库 > 欧拉项目代码(1--7)

欧拉项目代码(1--7)

第七题

求第10001个质数(用这个代码,我的笔记本大概算了40s):

count=1num=3def findPrime(s):    i=2    a=s    while i<s/2:        if s%i == 0:            s=s/i            break        else:            i=i+1    if s==a:        return True    else:        return Falsewhile count <10001:    if findPrime(num):        count =count + 1        num = num +2    else:        num = num+2print num-2

 

欧拉项目代码(1--7)