【题意】
求1~n中有多少数不被2~10的任意数整除.n<=10^18
【分析】
不能被2~10的任意数整除等价于不能被2,3,5,7整除,但是显然一个个试除并不现实,
那么我们可以根据容斥原理求得能被2,3,5,7整除的数再减去这些数即可
【Code】
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
typedef long long LL;
using namespace std;
int main()
{
LL n;
cin>>n;
LL s1= n/2+n/3+n/5+n/7;
LL s2= n/(2*3)+n/(2*5)+n/(2*7)+n/(3*5)+n/(3*7)+n/(5*7);
LL s3= n/(2*3*5)+n/(2*3*7)+n/(2*5*7)+n/(3*5*7);
LL s4= n/(2*3*5*7);
cout<<n-s1+s2-s3+s4;
return 0;
}