关于d函数的筛法
线性筛筛\(\sigma\)
线性筛筛\(\sigma_0\)
\(p\)是质数,\(\sigma_0(p)=2\)
对于一个\(i\),如果\(i\)和\(p\)互质,根据积性函数得\(\sigma_0 (i\ast p)=\sigma_0 (i)\ast \sigma_0 (p)\)
如果\(i\)和\(p\)不互质,那么\(p|i\)
设\(i=\prod_{i=1}^mP_i^{r_i}\)
则\(p\ast i=\prod_{i=2}^mP_i^{r_i}\ast P_1^{r_i+1}\)
\(\frac{i}{p}=\prod_{i=2}^m P_i^{r_i}\ast P_1^{r_i-1}\)
\(\sigma_0(i)=\prod_{i=1}^m(r_i+1)\)
\(\sigma_0(i\ast p)=\prod_{i=2}^m(r_i+1)+(r_1+2)\)
\(\sigma_0(\frac{i}{p}) = \prod_{i=2}^m(r_i+1)+r_1\)
设\(T=\prod_{i=2}^m(r_i+1)\)
\(\sigma_0(i)=T\ast (r_1+1)\)
\(\sigma_0(i\ast p)=T\ast (r_1+2)=\sigma_0(i)+T\)
\(\sigma_0(\frac{i}{p})=T\ast r_1=\sigma_0(i)-T\)
可得\(\sigma_0(i\ast p)=2\ast \sigma_0(i)-\sigma_0(\frac{i}{p})\)
线性筛筛\(\sigma\)
\(p\)是质数,\(\sigma(p)=p+1\)
对于一个\(i\),如果\(i\)和\(p\)互质,根据积性函数得\(\sigma(i\ast p)=\sigma(i)\ast \sigma(p)\)
如果\(i\)和\(p\)不互质,那么\(p|i\)
设\(i=\prod_{i=1}^mP_i^{r_i}\)
则\(p_1\ast i=\prod_{i=2}^mP_i^{r_i}\ast P_1^{r_i+1}\)
\(\frac{i}{p}=\prod_{i=2}^m P_i^{r_i}\ast P_1^{r_i-1}\)
\(\sigma_i=\prod_{i=1}^n\frac{p_i^{r_i+1}-1}{p_i-1}\)
\(\sigma_{i\ast p}=\prod_{i=2}^n\frac{p_i^{r_i+1}-1}{p_i-1}\ast \frac{p_i^{r_1+2}-1}{p_1-1}\)
\(\sigma_{\frac{i}{p}}=\prod_{i=2}^n\frac{p_i^{r_i+1}-1}{p_i-1}\ast \frac{p_i^{r_1}-1}{p_1-1}\)
设\(T=\prod_{i=2}^n\frac{p_i^{r_i+1}-1}{p_i-1}\)
\(\sigma_{i}=T\ast \frac{p_i^{r_1+1}-1}{p_1-1}\)
\(\sigma_{i\ast p}=T\ast \frac{p_i^{r_1+2}-1}{p_1-1}=\sigma_i+T\ast p_1^{r_1+1}\)
\(\sigma_{\frac{i}{p}}=T\ast \frac{p_i^{r_1}-1}{p_1-1}=\sigma_i-T\ast p_1^{r_1}\)
两边乘\(p_1\)得到\(\sigma_{\frac{i}{p}}\ast p_1=p_1\ast \sigma_i-T\ast p_1^{r_1+1}\)
后两个式子相加可得\(\sigma_{i\ast p_1}=(p_1+1)\ast \sigma_i-p_1\ast \sigma_{\frac{i}{p}}\)