题解 | #筛选法求素数#
筛选法求素数
https://www.nowcoder.com/practice/06c3dcc303654ef4926654023eca1e5a
while 1: try: n = int(input()) list = [i for i in range(2,n+1)] zero = 0 for j in list: for k in list[j-1:]: if k % j == 0: list.remove(k) zero += 1 for l in list: print(l,end=' ') print('') print(zero) except: break#题解#