algorithm-in-python/codes/dataStructure/primers.py

11 lines
282 B
Python
Raw Normal View History

2018-07-08 16:41:55 +08:00
def get(n)
li = [i for i in range(2,n)]
i = 1
while i <len(li):
prod =2 * li[i]
while prod <=li[-1]:
if prod in li:
li.remove(prod)
prod+=li[i]
i+=1
return li