题解 LOJ 6053

传送门


【分析】

显然 \(\boldsymbol f\) 为积性函数,且 \(\boldsymbol f(p)=p\oplus 1=\boldsymbol \varphi(p)\cdot 3^{[2\mid p]}\)

令 \(\boldsymbol g(p)=\boldsymbol \varphi(p)\cdot 3^{[2\mid p]}\) 且 \(\boldsymbol f=\boldsymbol g*\boldsymbol h\) ,则:

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

则 \(p>2\) 时:

\(\begin{aligned} \boldsymbol h(p^k)&=(p\oplus k)-p^{k-1}(p-1)-\sum_{i=1}^{k-1}\boldsymbol h(p^i)\cdot p^{k-i-1}\cdot (p-1) \\\\\boldsymbol h(p^{k-1})&=(p\oplus k-1)-p^{k-2}(p-1)-\sum_{i=1}^{k-2}\boldsymbol h(p^i)\cdot p^{k-i-2}\cdot (p-1) \\\\\boldsymbol h(p^k)-p\boldsymbol h(p^{k-1})&=(p\oplus k)-p(p\oplus k-1)-\boldsymbol h(p^{k-1})\cdot (p-1) \\\\\boldsymbol h(p^k)&=\boldsymbol h(p^{k-1})+(p\oplus k)-p(p\oplus k-1) \end{aligned}\)

而 \(p=2\) 时:

\(\begin{aligned} \boldsymbol h(p^k)&=(p\oplus k)-3p^{k-1}(p-1)-\sum_{i=1}^{k-1}\boldsymbol h(p^i)\cdot 3p^{k-i-1}\cdot (p-1) \\\\\boldsymbol h(p^{k-1})&=(p\oplus k-1)-3p^{k-2}(p-1)-\sum_{i=1}^{k-2}\boldsymbol h(p^i)\cdot 3p^{k-i-2}\cdot (p-1) \\\\\boldsymbol h(p^k)-p\boldsymbol h(p^{k-1})&=(p\oplus k)-p(p\oplus k-1)-\boldsymbol h(p^{k-1})\cdot 3(p-1) \\\\\boldsymbol h(2^k)-2\boldsymbol h(2^{k-1})&=(2\oplus k)-2(2\oplus k-1)-3\boldsymbol h(2^{k-1}) \\\\\boldsymbol h(2^k)&=-\boldsymbol h(2^{k-1})+(2\oplus k)-2(2\oplus k-1) \end{aligned}\)

而由于 \(\boldsymbol \varphi(p)\cdot 3^{[2\mid p]}=\boldsymbol f(p)=\boldsymbol h(p)+\boldsymbol g(p)=\boldsymbol h(p)+\boldsymbol \varphi(p)\cdot 3^{[2\mid p]}\) 得到 \(\boldsymbol h(p)=0\)

从而根据上述式子 \(k>1\) 时,\(\boldsymbol h(p^k)\) 可以由 \(\boldsymbol h(p^{k-1})\) 递推得到


我们定义 Powerful Number 为所有质因子均出现大于 \(1\) 次的数,以集合语言来讲,则是 \(PN=\{n|\forall p_i\mid n\to p_i^2\mid n, p_i\in Prime\}\)

上一篇:Sobol 序列并行化的实践经验


下一篇:Stone