一些反演求和过程?

.
问题 ∑ i , j < = n i a j a ( i , j ) b \sum_{i,j<=n}i^aj^a(i,j)^b i,j<=niaja(i,j)b f ( d ) = ∑ ( i , j ) = d i a j a F ( d ) = ∑ d ∣ i , d ∣ j i a j a f(d)=\sum_{(i,j)=d}i^aj^a \\ F(d)=\sum_{d|i,d|j}i^aj^a f(d)=(i,j)=diajaF(d)=di,djiaja可得 F ( d ) = ∑ k f ( k d ) F(d)=\sum_{k}f(kd) F(d)=kf(kd) f ( d ) = ∑ k F ( k d ) μ ( k ) f(d)=\sum_{k}F(kd)\mu(k) f(d)=kF(kd)μ(k)带入得到 ∑ d = 1 n d b f ( d ) \sum_{d=1}^nd^bf(d) d=1ndbf(d) = ∑ d = 1 n d b ∑ k F ( k d ) μ ( k ) =\sum_{d=1}^nd^b\sum_{k}F(kd)\mu(k) =d=1ndbkF(kd)μ(k) = ∑ i j < = n F ( i j ) i b μ ( j ) =\sum_{ij<=n}F(ij)i^b\mu(j) =ij<=nF(ij)ibμ(j) = ∑ T = 1 n F ( T ) ∑ d ∣ T d b μ ( T d ) =\sum_{T=1}^nF(T)\sum_{d|T}d^b\mu(\frac{T}{d}) =T=1nF(T)dTdbμ(dT)因为 F ( z ) = z 2 a ∑ i z < = n , j z < = n i a j a F(z)=z^{2a}\sum_{iz<=n,jz<=n}i^aj^a F(z)=z2aiz<=n,jz<=niaja = z 2 a ∗ ( ∑ i = 1 n z i a ) 2 =z^{2a}*(\sum_{i=1}^{\frac{n}{z}}i^a)^2 =z2a(i=1znia)2
可以得到 G ( x ) = ∑ [ n z ] = x F ( z ) = ( ∑ i = 1 n z i a ) 2 ∗ ( ∑ z z 2 a ) G(x)=\sum_{[\frac{n}{z}]=x}F(z)=(\sum_{i=1}^{\frac{n}{z}}i^a)^2*(\sum_zz^{2a}) G(x)=[zn]=xF(z)=(i=1znia)2(zz2a)
预处理伯努利数,可以 O ( n a ) O(\sqrt{n}a) O(n a)计算前缀和
让后考虑计算 μ ∗ i d b \mu*id^b μidb
注意到 I ∗ μ ∗ i d b = i d b I*\mu*id^b=id^b Iμidb=idb,考虑直接杜教筛即可


.
∑ i = 1 n ∑ j = 1 n ( i j ) ( i , j ) \sum_{i=1}^n\sum_{j=1}^n(ij)^{(i,j)} i=1nj=1n(ij)(i,j)
= ∑ d = 1 n ∑ ( i , j ) = d ( i j ) d =\sum_{d=1}^n\sum_{(i,j)=d}(ij)^d =d=1n(i,j)=d(ij)d
= ∑ d = 1 n d 2 d ∑ i d < = n ∑ j d < = n ( i j ) d [ ( i , j ) = 1 ] =\sum_{d=1}^nd^{2d}\sum_{id<=n}\sum_{jd<=n}(ij)^d[(i,j)=1] =d=1nd2did<=njd<=n(ij)d[(i,j)=1]
= ∑ d = 1 n d 2 d ∑ i d < = n ∑ j d < = n ( i j ) d ∑ t ∣ i , t ∣ j μ ( t ) =\sum_{d=1}^nd^{2d}\sum_{id<=n}\sum_{jd<=n}(ij)^d\sum_{t|i,t|j}\mu(t) =d=1nd2did<=njd<=n(ij)dti,tjμ(t)
= ∑ d = 1 , t = 1 n d 2 d μ ( t ) ∑ i , j < = n d t ( i t ) d ( j t ) d =\sum_{d=1,t=1}^nd^{2d}\mu(t)\sum_{i,j<=\frac{n}{dt}}(it)^d(jt)^d =d=1,t=1nd2dμ(t)i,j<=dtn(it)d(jt)d
= ∑ d = 1 , t = 1 n d 2 d t 2 d μ ( t ) ∑ i , j < = n d t ( i j ) d =\sum_{d=1,t=1}^nd^{2d}t^{2d}\mu(t)\sum_{i,j<=\frac{n}{dt}}(ij)^d =d=1,t=1nd2dt2dμ(t)i,j<=dtn(ij)d
F ( x , d ) = ∑ i , j < = x ( i j ) d F(x,d)=\sum_{i,j<=x}(ij)^d F(x,d)=i,j<=x(ij)d
= ∑ d t < = n d 2 d t 2 d μ ( t ) F ( n / d t , d ) =\sum_{dt<=n}d^{2d}t^{2d}\mu(t)F(n/dt,d) =dt<=nd2dt2dμ(t)F(n/dt,d)
发现有效的 d t dt dt只有 O ( n log ⁡ n ) O(n \log n) O(nlogn),问题变为如何计算 F ( x , d ) F(x,d) F(x,d)
F ( x , d ) = ( ∑ i = 1 x i d ) 2 F(x,d)=(\sum_{i=1}^xi^d)^2 F(x,d)=(i=1xid)2发现需要 min ⁡ ( O ( d ) , O ( x ) ) \min(O(d),O(x)) min(O(d),O(x))的复杂度来计算
于是先枚举 t t t,再卡常一下就可以了

你可能感兴趣的:(OI,数学,----数论,--------莫比乌斯反演)