质数个数_python3
KiKi求质数个数
http://www.nowcoder.com/questionTerminal/d3a404ee0f8d41f98bf4707035d91086
N = 1001 count = [0]*N l = list(range(2, N)) def countP(n): for i in range(2, n): count[i] = count[i-1] + 1 if i in l else count[i-1] for j in range(count[i]): if i * l[j] >= n: break l.remove(i*l[j]) if not i % l[j]: break countP(N) print(count[1000] - count[99]) #print(143)