23dfcca431 2011-02-23 kinaba: static const int N = 999999; 23dfcca431 2011-02-23 kinaba: vector<bool> isp(N+1, true); 23dfcca431 2011-02-23 kinaba: vector<int> ps; 23dfcca431 2011-02-23 kinaba: for(int p=2; p<=N; ++p) 23dfcca431 2011-02-23 kinaba: if( isp[p] ) { 23dfcca431 2011-02-23 kinaba: ps.push_back(p); 23dfcca431 2011-02-23 kinaba: for(int q=p+p; q<=N; q+=p) 23dfcca431 2011-02-23 kinaba: isp[q] = false; 23dfcca431 2011-02-23 kinaba: }