版本比较
数学trick收集整理
正文
增加 2 行删除 2 行
12234562 行未改动91011121313141516### Case 1> $O(\sqrt n)$ 求 $\sum_{i=1}^n \gcd(i,n)$ > $O(\sqrt n)$ 求 $\sum_{i=1}^n \gcd(i,n)$
::::info[提示]如何把这个求和转化为关于 $n$ 的因数的贡献?:::info[提示]2 行未改动::::
::::success[解]$$\because \gcd(i/d,n/d)=1$$$$\therefore n \text{ 的因数 } d \text{ 的贡献为 } \varphi\left(\frac {n}{d}\right) \times d$$ $$\therefore n \text{ 的因数 } d \text{ 的贡献为 } \varphi\left(\frac {n}{d}\right) \times d$$
枚举即可。::::