10年6个月前修改于 10年6个月前IP:湖南
821429
15楼
from math import sqrt 

def getPrime(n):
    if (n!=2) & (n&1==0) :
        return False
    for i in range(3,int(sqrt(n))+1,2):
        if n%i == 0:
            return False
    return True   

def  primePosition(x):
    count = 0
    if x==2:
        return 1
    if (x>1) & getPrime(x):
        for i in range(3, x,2):
            if getPrime(i):
                count += 1
        return count + 2
    return count
评论
文号 / 821429

实习会员
名片发私信
学术分 0
总主题 0 帖总回复 2 楼拥有证书:进士 笔友
注册于 2016/06/13 19:42:52最后登录 2016/07/17 21:17:11
主体类型:个人
所属领域:无
认证方式:邮箱
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的