# 懵逼鸟斯繁衍
$F(n)=sum_{d|n}f(d)$
$F(n)$与1的雷子卷积
$F=f*1 <=> f=F*mu$
$$
hugesum_{d|n}mu(x)={^{1(n=1)}_{0(n>1)}
$$
$$
hugesum_{i=1}^{n}sum_{j=1}^{m}[gcd(i,j)==1]
$$
等价于
$$
hugesum_{i=1}^{n}sum_{j=1}^{m}hugesum_{d|gcd(i,j)}mu(d)
$$
等价于
$$
hugesum_{d=1}^{n}[n/d][m/d]mu(d)
$$
将n/d分块处理所有n/d相等的数
$$
hugesum_{d=1}^{n}[n/d][m/d]
$$
```c++
for(int i=1;i<=min(n,m);i=last+1){
last=min(n/(n/i),m/(m/i));
ans+=(n/i)*(m/i)*(last-i+1);
}
for(int i=1;i<=min(n,m);i=last+1){
last=min(n/(n/i),m/(m/i));
ans+=(n/i)*(m/i)*(sum[last]-sum[i-1]);
}
//sum为mu的前缀和
```
形如
$x==1$
这样的式子
用
$$
hugesum_{d|x}mu(d)
$$
代替
### eg
求$1le i le n, 1 le j le m$
$$
hugesum_{i=1}^{n}sum_{j=1}^{m}[gcd(i,j)为质数]
$$
$$
hugesum_{p}sum_{i=1}^{n/p}sum_{j=1}^{m/p}[gcd(i,j)==1]
$$
$$
hugesum_{p为质数}sum_{i=1}^{n/p}sum_{j=1}^{m/p}sum_{d|gcd(i,j)}mu(d)
$$
$$
hugesum_{p为质数}sum_{d=1}^{frac{n}{p}}[frac{frac{n}{p}}{d}][frac{frac{m}{p}}{d}]mu(d)
$$
$$
hugesum_{dple n}sum_{d=1}^{frac{n}{p}}[frac{n}{pd}][frac{m}{pd}]mu(d)
$$
令Q=dp
$$
hugesum_{Q=1}^{n}[frac{n}{Q}][frac{m}{Q}]sum_{p|q}prime(p)mu(frac{Q}{p})
$$
$$
hugesum_{Q=1}^{n}[frac{n}{Q}][frac{m}{Q}]f(Q)
$$
$$
huge f(n)=sum_{p|n}prime(p)mu(frac{n}{p})
$$