Training 4: Number Theory
Revision as of 13:43, 12 May 2019 by Xiejiadong (talk | contribs)
Problem A
题意: $\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{m}lcm(i,j)$
题解: 原式=$\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{m}\frac{i \times j}{gcd(i,j)} = \sum\limits_{k=1}^{n}k\sum\limits_{i=1}^{\frac{n}{k}}\sum\limits_{j=1}^{\frac{m}{k}}i \times j[gcd(i,j)=k]$ 然后莫比乌斯反演得$\sum\limits_{k=1}^{n}mu[i] \times (1+...+\frac{n}{k}) \times (1+...+\frac{m}{k})$ 然后数论分块求和