51nod - 1363 - 最小公倍数之和 - 数论
作者:互联网
https://www.51nod.com/Challenge/Problem.html#!#problemId=1363
求\(\sum\limits_{i=1}^{n}lcm(i,n)\)
---
先换成gcd
\(\sum\limits_{i=1}^{n}\frac{i*n}{gcd(i,n)}\)
显而易见,枚举g
$ n * \sum\limits_{g|n} \frac{1}{g} \sum\limits_{i=1}^{n} i*[gcd(i,n)==g] $
提g,没有下整符号
$ n * \sum\limits_{g|n} \frac{1}{g} \sum\limits_{i=1}^{\frac{n}{g}} i*[gcd(i,\frac{n}{g})==1] $
标签:frac,gcd,limits,公倍数,sum,51nod,1363 来源: https://www.cnblogs.com/Yinku/p/10987912.html