Not so easy math

Can I get some hint. I am not able to figure out this question.

No of numbers between 1 to n which are divisible by x are [n/x]
where [] is greatest integer function.

Try to use it

I have tried this approach,but I guess it is not the optimised approach.Further, I haven’t use any bit manipulation technique. Can you suggest some better approach or some approach that involves bit manipulation.

I don’t think any other solution exists, because of the constraints are too large. Inclusion-Exclusion is the easiest solution we can think of.