Mobius反演的套路

Posted ah2002

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mobius反演的套路相关的知识,希望对你有一定的参考价值。

T1

(sum_{i=1}^N sum_{j=1}^M [(i,j)=1])

(f(d)=sum_{i=1}^N sum_{j=1}^M [(i,j)=d])

(g(d)=sum_{i=1}^N sum_{i=1}^M [d|(i,j)]=lfloor frac{N}{d} floor lfloor frac{M}{d} floor)

(g(n)=sum_{n|d} f(d))

(f(n)=sum_{n|d} mu(frac{d}{n})g(d))

(f(1)=sum_{i=1}^{min(N,M)} mu(i)lfloor frac{N}{i} floor lfloor frac{M}{i} floor)

T2

(sum_{i=1}^N sum_{j=1}^M (i,j))

(f(d)=sum_{i=1}^N sum_{j=1}^M d[(i,j)=d]=dsum_{i=1}^N sum_{j=1}^M [(i,j)=d]=dsum_{i=1}^{lfloor frac{min(N,M)}{d} floor} mu(i) lfloor frac{N}{id} floor lfloor frac{M}{id} floor)

(Ans=sum_{d=1}^{min(N,M)} f(d)=sum_{d=1}^{min(N,M)} dsum_{i=1}^{lfloor frac{min(N,M)}{d} floor} mu(i) lfloor frac{N}{id} floor lfloor frac{M}{id} floor)

(w=id)

(Ans=sum_{w=1}^{min(N,M)} sum_{d|w} mu(frac{w}{d}) lfloor frac{N}{w} floor lfloor frac{M}{w} floor=sum_{w=1}^{min(N,M)} lfloor frac{N}{w} floor lfloor frac{M}{w} floor sum_{d|w} mu(d))

(sum_{d|w} mu(d))显然是积性函数,线性筛后做下前缀和,离线(Theta(max(N,M)))

(sum_{w=1}^{min(N,M)} lfloor frac{N}{w} floor lfloor frac{M}{w} floor) 整除分块可以做到在线(Theta(sqrt{N}+sqrt{M}))

多组询问下总复杂度(Theta(max(N,M)+T(sqrt{N}+sqrt{M})))

T3

(sum_{i=1}^N sum_{j=1}^M frac{ij}{(i,j)})

(f(d)=sum_{i=1}^{lfloor frac{N}{d} floor} sum_{j=1}^{lfloor frac{M}{d} floor} ijd[(i,j)=1]=d sum_{i=1}^{lfloor frac{N}{d} floor} sum_{j=1}^{lfloor frac{M}{d} floor} ij[(i,j)=1])

(Ans=sum_{d=1}^{min(N,M)} f(d))

(Ans=sum_{d=1}^{min(N,M)} d sum_{i=1}^{lfloor frac{N}{d} floor} sum_{j=1}^{lfloor frac{M}{d} floor} ijsum_{n|(i,j)} mu(n))

(Ans=sum_{d=1}^{min(N,M)} d sum_{n=1}^{lfloor frac{min(N,M)}{d} floor} n (sum_{i=1}^{lfloor frac{N}{dn} floor} i)n(sum_{j=1}^{lfloor frac{M}{dn} floor} j))

(w=dn)

(Ans=sum_{w=1}^{min(N,M)} (sum_{i=1}^{lfloor frac{N}{w} floor} i)(sum_{j=1}^{lfloor frac{M}{w} floor} j) wsum_{n|w} n mu(n))

线筛前缀和+整除分块

复杂度与上题相同

以上是关于Mobius反演的套路的主要内容,如果未能解决你的问题,请参考以下文章

两句话题意 感觉这一题的套路很强

Mobius反演定理

关于Mobius反演

关于Mobius反演

bzoj 2301: [HAOI2011]Problem b mobius反演 RE

各种反演难题训练集合