Not So easy Maths

I am unable to get any trick that should I use segmented sieve or any bit hacks is there.
And also what approach should be there for a counting problem.

@02.adarsh.99
It is based on inclusion exclusion principle
lets say we had primes <= 6 = {2,3,5}
Ans = n/2 + n/3 + n/5 - n/6 - n/15 - n/10 + n/60

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.