Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int n=1e8;
- vector<int> lp(n+1,true);
- vector<int> primes;
- int main() {
- // your code here
- // for(int i=0;i<=n;i++ ) lp[i]=i;
- for(int i=2;i<=sqrt(n);i++ ){
- if(lp[i]==true) {
- for(int j=i*i;j<=n;j+=i) {
- lp[j]=false;
- }
- primes.push_back(i);
- }
- }
- for(int i=1;i<=primes.size();i+=100) {
- cout<<primes[i-1]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement