看这里->此处
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
bool prime[maxn];
void isPrime(ll n)///筛到n之间的素数
{
memset(prime,true,sizeof(prime));///标记所有数都为素数
for(ll i=4;i<=n;i+=2){
prime[i]=false;///筛除偶数
}
for(ll i=3;i<=n;i+=2){
if(prime[i]){
for(ll j=i*i;j<=n;j+=(2*i)){
prime[j]=false;
}
}
}
}
int main()
{
std::ios::sync_with_stdio(false);
ll n;
while(cin>>n){
isPrime(n);
for(ll i=0;i<n;i++){
if(prime[i])cout<<i<<" ";
}
cout<<endl;
}
return 0;
}