the
From small to large k of the number of square-free factors. (the original problem expression slightly problematic)
K<=1e+9
This problem has nothing to do with inversion, it uses the Mobius function.
First of all confirm that the two-point answer is then validated, now the problem is transformed to find the number of square-free factors in [1,mid].
How to ask for it. Consider the 1~SQRT (P is the set of mass in the (m))
Multiples of the total number of =[(PI) 2]−[(PI∗PJ) 2 multiples]+[(PI∗PJ∗PK) 2 multiples of]−[(PI∗PJ∗PK∗PT) 2) ... Total number of =[(p_i) ^2 multiples of]-[(p_i*p_j) ^2 multiple]+[(p_i*p_j*p_k) ^2 multiples of]-[(p_i*p_j*p_k*p_t) ^2.
How to sum it. By observing we find that the previous coefficients of the term [x^2 multiples] of any [X2 multiples] are just mu[x].
And then it's perfectly settled,
Number of ANS1 to M non-square factor =∑⌊m√⌋iμ (i) ∗⌊m/i2⌋ans_{1 to M non-square factor number}=\sum_i^{\lfloor \sqrt m \rfloor}\mu (i) *\lfloor M/i^2\rfloor
#include <cstdio> #include <cmath> #include <cstring> #include <
Algorithm> using namespace std;
typedef long Long LL;
const int maxn=100015, n=100000;
int _TEST,N,M,MU[MAXN],P[MAXN];
LL ans;
BOOL VIS[MAXN];
void Get_mu () {memset (vis,1,sizeof (VIS));
Mu[1]=1;
for (int i=2;i<=n;i++) {if (vis[i]) p[++p[0]]=i, mu[i]=-1;
for (int j=1;j<=p[0]&&i*p[j]<=n;j++) {vis[i*p[j]]=false;
if (i%p[j]==0) {mu[i*p[j]]=0; break;}
Mu[i*p[j]]=-mu[i];
}} ll get (ll mid) {ll res=0;
int T=sqrt (mid);
for (LL i=1;i<=t;i++) res+= (Mid/(i*i)) *mu[i];
return res;
int main () {freopen ("bzoj2440.in", "R", stdin);
Freopen ("Bzoj2440.out", "w", stdout);
Get_mu ();
scanf ("%d", &_test);
while (_test--) {scanf ("%d", &m); LL l=m,r=1e+10;
Ans=1;