标签:莫比乌斯反演
mu[1] = 1;
for(i = 2; i <= n; i++) {
if(!vis[i]) {
prime[++c] = i;
mu[i] = -1;
}
for(j = 1; prime[j] * i <= n; j++) {
vis[prime[j] * i] = 1;
if(i % prime[j] == 0) {
mu[prime[j] * i] = 0;
break;
}
mu[prime[j] * i] = -mu[i];
}
}
标签:莫比乌斯反演
原文地址:http://blog.csdn.net/qq_21110267/article/details/45397595