问题引入
(sigma_0(n)=n的正因子数量)
求(S(n,k)=sum_{i=1}^nsigma_0(i^k)quad(n,kle10^{10}))
概念
-
积性函数:(f(a)*f(b)=f(a*b)quad(a,b互质))
-
完全积性函数则不要求互质
-
P为质数集合
线性方法
欧拉筛+积性函数
- (令sigma(i)=sigma_0(i^k),则S(n,k)=sumsigma(i)\)
- (sigma_0显然为积性函数)
- (当sigma(i)*sigma(j)=sigma(i*j) (gcd(i,j)=1)时sigma为积性函数,\ 又ecause gcd(i^k,j^k)显然为1 (i,j互质,所以i^k,j^k没有除1以外的公因子)\ hereforesigma为积性函数)
- (当i为1时,sigma(1)=sigma_0(1^k)=1)
- (当i质数时\sigma(i)=sigma_0(i^k)=k+1)
- (当gcd(i,j)=1时\sigma(i*j)=sigma(i)*sigma(j))
- (当gcd(p[i],j)=p[i],且p[i]为j的最小质因子时,\ 即j=p[i]^{a[i]}*p[i+1]^{a[i+1]}*...\ herefore j^k=p[i]^{a[i]*k}*p[i+1]^{a[i+1]*k}*...\ hereforesigma(j)=(a[i]*k+1)*(a[i+1]*k+1)*...\ 又ecausesigma(j/p[i])=((a[i]-1)*k+1)*(a[i+1]+k+1)*...\ 且sigma(j*p[i])=((a[i]+1)*k+1)*(a[i+1]+k+1)*...\ herefore sigma(j*p[i])=2*sigma(j)-sigma(j/p[i]))