void init(){
for (int i=0;i<20000000;++i)isP[i]=1;
for (int i=2;i<=18409201;++i)
{
if(isP[i]){
table.push_back(i);
for (int j=2;j*i<=18409201;j++)isP[j*i]=0;
}
}
}
筛选法打印素数表
最新推荐文章于 2023-08-10 23:41:20 发布
void init(){
for (int i=0;i<20000000;++i)isP[i]=1;
for (int i=2;i<=18409201;++i)
{
if(isP[i]){
table.push_back(i);
for (int j=2;j*i<=18409201;j++)isP[j*i]=0;
}
}
}