zoukankan      html  css  js  c++  java
  • 莫比乌斯反演初探

    本文的部分latex垮掉了。我也不知道为什么(有毒),建议将代码拷贝至本地md编编辑器阅读。

    数论(整除)分块

    整除分块:设函数(f(x)=lfloorfrac{N}{x} floor, xin N^+),期望在根号时间内求得(sum_{x} f(x))的值。

    【定理1】(f(x))的值域大小不超过(2sqrt{N})

    【定理2】若(x=q)(f(x)=p)的解,则(x=lfloorfrac{N}{lfloor N/q floor} floor)(f(x)=p)的最大解。

    证明如下

    [ ext{make } N=pq+r(0le r<q) \ ext{make } N=p*(q+k)+t(0le t<q+d) \ pk+t=r\ t=r-pkge 0 \ klelfloor frac{r}{p} floor=lfloor frac{Nmod q}{p} floor \ egin{aligned} x_{max}&=q+k_{max} \ &=q+lfloor frac{Nmod q}{p} floor\ &=q+lfloor frac{N-lfloor N/q floor*q}{lfloor N/q floor} floor\ &=lfloor q+frac{N-lfloor N/q floor*q}{lfloor N/q floor} floor\ &=lfloorfrac{lfloor N/q floor*q +N-lfloor N/q floor*q}{lfloor N/q floor} floor\ &=lfloorfrac{N}{lfloor N/q floor} floor\ end{aligned} ]

    莫比乌斯函数

    【定义】

    定义 (mu(d))

    [mu(d)=egin{cases} 1&d=1\ (-1)^k&d=Pi^{k}_{i=1}P_i\ 0&else end{cases} ]

    (mu(d)) 为关于 (d) 的莫比乌斯函数。

    【性质】

    • 对于任意 (nin N^*) ,有 (sum_{d|n}mu(d)=[n=1])
    • 对于任意 (nin N^*) ,有 (sum_{d|n}dfrac{mu(d)}{d}=dfrac{phi(n)}{n})

    【 递推】 结合线性筛素数。

    【配套练习 】

    YY的GCD

    [egin{aligned} r&=sum_{pinPr}sum _{x=1}^nsum_{y=1}^m [gcd(x,y)=p]\ &=sum_{p=Pr}sum_{x=1}^{lfloor n/p floor}sum_{y=1}^{lfloor m/p floor}[gcd(x,y)=1] &star\ r&=sum_{p=Pr}sum_{x=1}^{lfloor n/p floor}sum_{y=1}^{lfloor m/p floor}sum_{d|gcd(x,y)}mu(d) &star\ &=sum_{p=Pr}sum_{d=1}^{lfloorfrac{min(n,m)}{p} floor}mu(d)sum_{x=1}^{lfloor n/p floor}sum_{y=1}^{lfloor m/p floor}[d|gcd(x,y)]\ &=sum_{p=Pr}sum_{d=1}^{lfloorfrac{min(n,m)}{p} floor}mu(d)lfloorfrac{n}{pd} floorlfloorfrac{m}{pd} floor\ ext{设 }k&=pd\ r&=sum_{p=Pr}sum_{d=1}^{lfloorfrac{min(n,m)}{p} floor}mu(frac{k}{p})lfloorfrac{n}{k} floorlfloorfrac{m}{k} floor\ &=sum_{k=1}^{min(n,m)}sum_{pinPr,pmid k}mu(frac{k}{p})lfloorfrac{n}{k} floorlfloorfrac{m}{k} floor\ ext{预处理}f(k)&=sum_{pinPr,pmid k}mu(frac{k}{p}) ext{对于所有的 k(s)}\ r&=sum_{k=1}^{min(n,m)}f(k)lfloorfrac{n}{k} floorlfloorfrac{m}{k} floor\ end{aligned} ]

    [国家集训队]Crash的数字表格

    [egin{aligned} r(n,m)&=sum_{i=1}^nsum_{j=1}^mfrac{i*j}{gcd(i,j)}\ &=sum_{d}sum_{i=1}^nsum_{j=1}^mfrac{i*j}{d} [gcd(i,j)=d]\ &=sum_{d}sum_{i=1}^{lfloorfrac{n}{d} floor}sum_{j=1}^{lfloorfrac{m}{d} floor}d*i*j[gcd(i,j)=1]\ &=sum_{d=1}^{min(n,m)}dsum_{i=1}^{lfloorfrac{n}{d} floor}sum_{j=1}^{lfloorfrac{m}{d} floor}i*j[gcd(i,j)=1]\ q(n,m)&=sum_{i=1}^nsum_{j=1}^m i*j[gcd(i,j)=1] &star\ &=sum_{i=1}^nsum_{j=1}^m i*jsum_{k|gcd(i,j)}mu(k) &star\ &=sum_{k=1}^{min(n,m)}mu(k)sum_{kmid i}^nsum_{kmid j}^m i*j\ &=sum_{k=1}^{min(n,m)}mu(k)sum_{i=1}^{lfloorfrac{n}{k} floor}sum_{j=1}^{lfloorfrac{m}{k} floor} i*j*k^2\ &=sum_{k=1}^{min(n,m)}k^2mu(k)sum_{i=1}^{lfloorfrac{n}{k} floor}sum_{j=1}^{lfloorfrac{m}{k} floor} i*j\ r(n,m)&=sum_{d=1}^{min(n,m)}d*q(d,lfloorfrac{n}{d} floor,lfloorfrac{m}{d} floor) end{aligned} ]

    莫比乌斯反演

    【定理1】若 (F(n))(f(n)) 是定义在 (N) 上的两个函数,且满足 (F(n)=sum_{dmid n}f(d)),那么 (f(n)=sum_{dmid n}mu(d)F(dfrac{n}{d}))
    证明:

    [egin{aligned} sum_{dmid n}mu(d)F(dfrac{n}{d})&=sum_{dmid n}mu(d)sum_{imiddfrac{n}{d}}f(i)\ &=sum_{imid n}f(i)sum_{dmiddfrac{n}{i}}mu(d)\ &=f(n) &star\ end{aligned} ]

    【定理2】若 (F(n))(f(n)) 是定义在 (N) 上的两个函数,且满足 (F(n)=sum_{nmid d}f(d)),那么 (f(n)=sum_{nmid d}mu(dfrac{d}{n})F(d))

    【配套练习】

    [SDOI2015] 约数个数和

    [SDOI2014] 数表

    [ ext{在忽略a的限制下} egin{aligned} F(x)&=sum_{dmid x} d \ r(n,m)&=sum_{i=1}^nsum_{j=1}^m F(gcd(i,j))\ &=sum_{d=1}^{min(n,m)}F(d)sum_{i=1}^nsum_{j=1}^m[gcd(i,j)=d]\ &=sum_{d=1}^{min(n,m)}F(d)sum_{d|k}mu(frac{k}{d})lfloorfrac{n}{k} floorlfloorfrac{m}{k} floor\ &=sum_{k=1}^{min(n,m)}lfloorfrac{n}{k} floorlfloorfrac{m}{k} floorsum_{dmid k}F(d)mu(frac{k}{d}) end{aligned} ]

  • 相关阅读:
    分组密码之DES
    QTreeWidget实现一个打包小工具
    实验吧web记录
    南邮CTF记录
    XSS学习之xss20
    安全之路的一些参考
    sqlilabs_Less2128
    sqlilabs_Less110
    BUGKU练习
    看了几天的EXTJS了
  • 原文地址:https://www.cnblogs.com/nosta/p/9444588.html
Copyright © 2011-2022 走看看