Min25筛(引入)

问题引入

\(\sigma_0(n)=n的正因子数量\)

求\(S(n,k)=\sum_{i=1}^n\sigma_0(i^k)\quad(n,k\le10^{10})\)

概念

  1. 积性函数:\(f(a)*f(b)=f(a*b)\quad(a,b互质)\)

  2. 完全积性函数则不要求互质

  3. P为质数集合

线性方法

欧拉筛+积性函数

  • \(令\sigma(i)=\sigma_0(i^k),则S(n,k)=\sum\sigma(i)\\\)
  • \(\sigma_0显然为积性函数\)
  • \(当\sigma(i)*\sigma(j)=\sigma(i*j)\ (gcd(i,j)=1)时\sigma为积性函数,\\ 又\because gcd(i^k,j^k)显然为1\ (i,j互质,所以i^k,j^k没有除1以外的公因子)\\ \therefore\sigma为积性函数​\)
  1. \(当i为1时,\sigma(1)=\sigma_0(1^k)=1​\)
  2. \(当i质数时\\\sigma(i)=\sigma_0(i^k)=k+1​\)
  3. \(当gcd(i,j)=1时\\\sigma(i*j)=\sigma(i)*\sigma(j)​\)
  4. \(当gcd(p[i],j)=p[i],且p[i]为j的最小质因子时,\\ 即j=p[i]^{a[i]}*p[i+1]^{a[i+1]}*...\\ \therefore j^k=p[i]^{a[i]*k}*p[i+1]^{a[i+1]*k}*...\\ \therefore\sigma(j)=(a[i]*k+1)*(a[i+1]*k+1)*...\\ 又\because\sigma(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)*...\\ \therefore\ \sigma(j*p[i])=2*\sigma(j)-\sigma(j/p[i])​\)

Min25筛

上一篇:Codeforces 1106C Lunar New Year and Number DivisionLunar |数学


下一篇:POJ2115C Looooops