Run ID:59481
提交时间:2023-10-28 16:20:37
#include<iostream> using namespace std; const long long n=3000000; int b[n+1]={0}; int main(){ for(int i=2;i*i<=3000000;i++) { if(b[i]) continue; for(int j=i*i;j<=n;j+=i) b[j]=1; } for(int i=2;i<=n;i++) { if(!b[i]) cout<<i<<' '; } return 0; }