# 51Nod1220 约数之和

（懒得重写了……直接把51nod上我的那篇博客贴过来好了）
（注：以下出现的所有$\sigma_k(n)$均表示$\sum_{d|n}d^k$，即$n$的所有约数的$k$次幂之和）
\begin{align} Ans=&\sum_{i=1}^n\sum_{j=1}^n\sigma_1(i j) \end{align}

\begin{align} \sigma_1(i j)=\sum_{p|i}\sum_{q|j}[(p,q)=1]\frac{p j}q \end{align}

\begin{align} Ans=&\sum_{i=1}^n\sum_{j=1}^n\sigma_1(i j)\\ =&\sum_{i=1}^n\sum_{j=1}^n\sum_{p|i}\sum_{q|j}[(p,q)=1]\frac{p j}q\\ =&\sum_{d=1}^n\mu(d)\sum_{i=1}^n\sum_{j=1}^n\sum_{p|i}\sum_{q|j}[d| (p,q)]\frac{p j}q\qquad(莫比乌斯反演)\\ =&\sum_{d=1}^n\mu(d)\sum_{d|p}\sum_{d|q}\frac p q\sum_{p|i}\sum_{q|j}j\\ =&\sum_{d=1}^n\mu(d)\sum_{d|p}\sum_{d|q}\frac p q\left\lfloor\frac n p\right\rfloor q\frac{\left\lfloor\frac n q\right\rfloor\left(\left\lfloor\frac n q\right\rfloor+1\right)}2\\ =&\sum_{d=1}^n\mu(d)\sum_{d|p}p\left\lfloor\frac n p\right\rfloor\sum_{d|q}\frac{\left\lfloor\frac n q\right\rfloor\left(\left\lfloor\frac n q\right\rfloor+1\right)}2\\ =&\sum_{d=1}^n\mu(d)d\left(\sum_{p=1}^{\left\lfloor\frac n d\right\rfloor}p\left\lfloor\frac n{d p}\right\rfloor\right)\left(\sum_{q=1}^{\left\lfloor\frac n d\right\rfloor}\frac{\left\lfloor\frac n{d q}\right\rfloor\left(\left\lfloor\frac n{d q}\right\rfloor+1\right)}2\right) \end{align}

\begin{align} &\sum_{i=1}^n i\left\lfloor\frac n i\right\rfloor\\ &\sum_{i=1}^n\left\lfloor\frac n i\right\rfloor\left(\left\lfloor\frac n i\right\rfloor+1\right) \end{align}

\begin{align} \sum_{i=1}^n i\left\lfloor\frac n i\right\rfloor=\sum_{i=1}^n\sigma_1(i) \end{align}

\begin{align} &\sum_{i=1}^n\left\lfloor\frac n i\right\rfloor\left(\left\lfloor\frac n i\right\rfloor+1\right)\\ =&\sum_{i=1}^n\sum_{j=1}^{\left\lfloor\frac n i\right\rfloor}j\\ =&\sum_{j=1}^n j\sum_{i=1}^{\left\lfloor\frac n j\right\rfloor}1\\ =&\sum_{i=1}^n i\left\lfloor\frac n i\right\rfloor \end{align}

\begin{align} Ans=\sum_{d=1}^n\mu(d)d\left(\sum_{i=1}^{\left\lfloor\frac n i\right\rfloor}\sigma_1(i)\right)^2 \end{align}
（ps：结果如此简洁）

\begin{align} S_f(n)=1-\sum_{d=2}^n d S_f\left(\left\lfloor\frac n d\right\rfloor\right) \end{align}

233333333
posted @ 2017-06-03 16:41  AntiLeaf  阅读(1285)  评论(1编辑  收藏  举报