首先这个约数公式要记住,具体见这篇题解
然后剩下的就是比较简单的套路操作了,最后会化出来
\[\sum_{d=1}^{min(n,m)}\sum_{d|x}\sum_{d|y}\lfloor\frac{n}{x}\rfloor\lfloor\frac{m}{y}\rfloor u(d)=\sum_{d=1}^{min(n,m)}u(d)(\sum_{d|x}\lfloor\frac{n}{x}\rfloor)(\sum_{d|y}\lfloor\frac{m}{y}\rfloor)=\sum_{d=1}^{min(n,m)}u(d)(\sum_{k=1}^{\lfloor\frac{n}{d}\rfloor}\lfloor\frac{n}{dk}\rfloor)(\sum_{k=1}^{\lfloor\frac{m}{d}\rfloor}\lfloor\frac{m}{dk}\rfloor)=\sum_{d=1}^{min(n,m)}u(d)(\sum_{k=1}^{\lfloor\frac{n}{d}\rfloor}\lfloor\frac{\lfloor\frac{n}{d}\rfloor}{k}\rfloor)(\sum_{k=1}^{\lfloor\frac{m}{d}\rfloor}\lfloor\frac{\lfloor\frac{m}{d}\rfloor}{k}\rfloor) \]令\(f(x)=\sum_{k=1}^x\lfloor\frac{x}{k}\rfloor\),则求式等于
\[\sum_{d=1}^{min(n,m)}u(d)f(\lfloor\frac{n}{d}\rfloor)f(\lfloor\frac{m}{d}\rfloor) \]预处理出\(f\),然后对这个式子进行数论分块就好了
标签:约数,lfloor,frac,min,sum,个数,rfloor From: https://www.cnblogs.com/dingxingdi/p/18175933