其他分享
首页 > 其他分享> > 题解 SP34112 UDIVSUM - The Sum of Unitary Divisors

题解 SP34112 UDIVSUM - The Sum of Unitary Divisors

作者:互联网

传送门


【分析】

\(\boldsymbol {\sigma^*}\) 的积性容易验证,则仅考虑其在质数幂处的值

\(\displaystyle \boldsymbol {\sigma^*}(p^k)=\sum_{i=0}^kp^i[\gcd(p^i, p^{k-i})=1]=\sum_{i=0}^k p^i[\min(i, k-i)=0]=p^k+[k>0]\)

由于该积性函数具有很好的性质:\(\boldsymbol {\sigma^*}(p)=p+1=\boldsymbol {\sigma}(p)\) ,故考虑 Powerful Number 筛:

令积性函数 \(\boldsymbol h\) 满足 \(\boldsymbol {\sigma^*}=\boldsymbol \sigma*\boldsymbol h\)

\(\begin{aligned} \boldsymbol {\sigma^*}(p^k)&=\sum_{i=0}^k\boldsymbol \sigma(p^i)\boldsymbol h(p^{k-i})&(k>0) \\\\ \boldsymbol {\sigma^*}(p^k)&=\sum_{i=1}^{k-1}\boldsymbol \sigma(p^i)\boldsymbol h(p^{k-i})+\boldsymbol \sigma(p^k)+\boldsymbol h(p^k) \\\\ \boldsymbol h(p^k)&=\boldsymbol {\sigma^*}(p^k)-\boldsymbol \sigma(p^k)-\sum_{i=1}^{k-1}\boldsymbol \sigma(p^i)\boldsymbol h(p^{k-i}) \end{aligned}\)

代入迭代得:

\(\begin{aligned} \boldsymbol h(1)&=1 \\\\ \boldsymbol h(p)&=\boldsymbol {\sigma^*}(p)-\boldsymbol \sigma(p)-\sum_{i=1}^{1-1}\boldsymbol \sigma(p^i)\boldsymbol h(p^{1-i})&=0 \\\\ \boldsymbol h(p^2)&=\boldsymbol {\sigma^*}(p^2)-\boldsymbol \sigma(p^2)-\sum_{i=1}^{2-1}\boldsymbol \sigma(p^i)\boldsymbol h(p^{2-i})&=-p \\\\ \boldsymbol h(p^3)&=\boldsymbol {\sigma^*}(p^3)-\boldsymbol \sigma(p^3)-\sum_{i=1}^{3-1}\boldsymbol \sigma(p^i)\boldsymbol h(p^{3-i})&=0 \end{aligned}\)

继续迭代观察可发现 \(\boldsymbol h(p^k)=0, k\geq 3\) ,可用数学归纳法证明


由此 \(\boldsymbol h(p^k)=\begin{cases} \begin{aligned} -p&, k=2 \\\\0&, k\neq 2 \end{aligned} \end{cases}, k>0\)

且由 Powerful Number 筛,有:

\(\begin{aligned} S(n)&=\sum_{i=1}^n\boldsymbol {\sigma^*}(i) \\\\&=\sum_{i=1}^n\sum_{d\mid i}\boldsymbol h(d)\boldsymbol \sigma({i\over d}) \\\\&=\sum_{d=1}^n \boldsymbol h(d)\sum_{i=1}^n[d\mid i]\boldsymbol \sigma({i\over d}) \\\\&=\sum_{d \in PN} \boldsymbol h(d)\sum_{i=1}^{n/d} \boldsymbol \sigma(i) \\\\&=\sum_{d \in PN} \boldsymbol h(d)S_d(n/d) \end{aligned}\)

而 \(\displaystyle S_d(n)=\sum_{i=1}^n\boldsymbol \sigma(i)=\sum_{i=1}^n \sum_{d\mid i}d=\sum_{d=1}^n d\cdot (n/d)\)

对右边整除分块即可 \(O(\sqrt n)\) 时间内求解 \(S_d(n)\)

标签:UDIVSUM,begin,Unitary,end,题解,sum,boldsymbol,aligned,sigma
来源: https://www.cnblogs.com/JustinRochester/p/15354801.html