import java.util.ArrayList;
/**
* Created by dong on 2018/3/31 0031.
*/
public class Main{
public static void main(String[] args){
ArrayList<Integer> a=new ArrayList<Integer>();
ArrayList<Integer> b=new ArrayList<Integer>();
for(int i=2;i<201;i++)
a.add(i);
//初始化a
int n=(int) Math.sqrt(200);
//开根号,计算范围
while (a.get(0)<=n){
for(int i=1;i<a.size();i++){
if(a.get(i)%a.get(0)!=0)
b.add(a.get(i)); //b来存储筛选成功的元素
}
b.add(a.get(0));
//将第一位元素添加到最后
a=b;
b=new ArrayList<Integer>();
//将筛选后的List,存入a
//并将b制空,进入下一次筛选
}
System.out.println(a.toString());
//打印2~200内的素数
}
}
#! python
#-*- coding:utf-8 -*-
import math
def main():
list1=[i for i in range(2,201)]
list2=[]
n=int(math.sqrt(200))
while list1[0] <= n:
for i in list1[1:]:
if i%list1[0]!=0:
list2.append(i)
list2.append(list1[0])
list1=list2
list2=[]
print(list1)
print(len(list1))
if __name__ == '__main__':
main()