#include
using namespace std;
#define ll long long
ll find_no_primes(ll n)
{
ll a[]={2,3,5,7,11,13,17,19};
ll ans=0;
for(ll i=1;i<=(1<<8-1);i++)
{
ll num=i;
ll num_setBits = __builtin_popcount(num);
ll count=0;
ll dem=1;
while(num!=0)
{
if(num&1)
dem*=a[count];
count++;
num=num>>1;
}
if(num_setBits&1)
ans+=(n/dem);
else
ans-=(n/dem);
}
return ans;
}
int main()
{
int t;
cin>>t;
while(t–)
{
ll n;
cin>>n;
ll ans=find_no_primes(n);
cout<<ans<<endl;
}
return 0;
}
Please tell the problem with the code?
this part hasnt been discussed in the video
this code is discussed in the video
have a look
you have send the wrong code,please send the correct one
sorry the ide was overwritten now this code is correct
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.