#include<bits/stdc++.h>
using namespace std;
#define M 100000000
bool check(long long N,long long pos)
{
return (bool)(N&(1<<pos));
}
long long setit(long long N,long long pos)
{
return N=(N|(1<<pos));
}
long long status[(M/32)+5],i,j;
vector<long long>vec;
void bit_sieve()
{
for(i=3;i<=sqrt(M);i+=2)
{
if(check(status[i/32],i%32)==0)
{
for(j=i*i;j<=M;j+=i*2)
{
status[j/32]=setit(status[j/32],j%32);
}
}
}
vec.push_back(2);
for(i=3;i<=M;i+=2)
{
if(check(status[i/32],i%32)==0)
{
vec.push_back(i);
}
}
}
main()
{
bit_sieve();
long long sz=vec.size();
cout<<sz<<endl;
}
using namespace std;
#define M 100000000
bool check(long long N,long long pos)
{
return (bool)(N&(1<<pos));
}
long long setit(long long N,long long pos)
{
return N=(N|(1<<pos));
}
long long status[(M/32)+5],i,j;
vector<long long>vec;
void bit_sieve()
{
for(i=3;i<=sqrt(M);i+=2)
{
if(check(status[i/32],i%32)==0)
{
for(j=i*i;j<=M;j+=i*2)
{
status[j/32]=setit(status[j/32],j%32);
}
}
}
vec.push_back(2);
for(i=3;i<=M;i+=2)
{
if(check(status[i/32],i%32)==0)
{
vec.push_back(i);
}
}
}
main()
{
bit_sieve();
long long sz=vec.size();
cout<<sz<<endl;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন