const int maxn=1000000;
int counter;
int prinum[10005];
bool prime[maxn];
void pri()
{
memset(prime,true,sizeof(prime));
for (int i=2;i*i<=maxn;i++)
if (prime[i])
for (int j=i<<1;j<=maxn;j+=i)
prime[j]=false;
for (int i=2;i<=maxn;i++)
if (prime[i])
prinum[counter++]=i;
}
筛法求素数
最新推荐文章于 2023-08-10 23:41:20 发布