埃氏筛
<pre><code>#include <iostream>
using namespace std;
const int maxn = 1e6+5;
bool isprime[maxn];
void sieve(){
for(int i = 1; i <= maxn; i++){
isprime[i] = true;
}
isprime[0] = isprime[1] = false;
for(int i = 0; i <= maxn; i++){
if(isprime[i]){
for(int j = 2*i; j <= maxn; j+=i){
isprime[j] = false;
}
}
}
return;
} </code></pre>