HDU 5608 function(杜教筛)
Posted jpphy0
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 5608 function(杜教筛)相关的知识,希望对你有一定的参考价值。
目录
0 链接
1 描述
- 已 知 N 2 − 3 N + 2 = ∑ d ∣ N f ( d ) , 求 ∑ i = 1 n f ( i ) . 已知 N^2-3N+2 = \\sum_{d|N}f(d), 求\\sum_{i=1}^{n}f(i). 已知N2−3N+2=∑d∣Nf(d),求∑i=1nf(i).
2 分析
2.1杜教筛
N
2
−
3
N
+
2
=
∑
d
∣
N
f
(
d
)
,
根
据
莫
比
乌
斯
反
演
得
:
N^2-3N+2 = \\sum_{d|N}f(d),根据莫比乌斯反演得:
N2−3N+2=d∣N∑f(d),根据莫比乌斯反演得:
f
(
n
)
=
∑
d
∣
n
(
d
−
2
)
⋅
(
d
−
1
)
⋅
μ
(
n
d
)
f(n)=\\sum_{d|n}(d-2)\\cdot (d-1)\\cdot \\mu(\\frac{n}{d})
f(n)=d∣n∑(d−2)⋅(d−1)⋅μ(dn)
( g ∗ f ) ( n ) = ∑ d ∣ n g ( d ) ⋅ f ( n d ) = ∑ d ∣ n g ( n d ) ⋅ f ( d ) (g*f)(n) = \\sum_{d|n}g(d)\\cdot f(\\frac{n}{d}) = \\sum_{d|n}g(\\frac{n}{d})\\cdot f(d) (g∗f)(n)=d∣n∑g(d)⋅f(dn)=d∣n∑g(dn)⋅f(d)
∑
i
=
1
n
(
g
∗
f
)
(
i
)
=
∑
i
=
1
n
∑
d
∣
i
g
(
d
)
⋅
f
(
i
d
)
\\sum_{i=1}^{n}(g*f)(i)= \\sum_{i=1}^{n}\\sum_{d|i}g(d)\\cdot f(\\frac{i}{d})
i=1∑n(g∗f)(i)=i=1∑nd∣i∑g(d)⋅f(di)
=
∑
d
=
1
n
(
g
(
d
)
⋅
∑
i
d
=
1
⌊
n
d
⌋
f
(
i
d
)
)
=
∑
d
=
1
n
g
(
d
)
⋅
S
(
⌊
n
d
⌋
)
=\\sum_{d=1}^{n}\\left(g(d)\\cdot \\sum_{\\frac{i}{d}=1}^{\\lfloor\\frac{n}{d}\\rfloor}f(\\frac{i}{d})\\right)=\\sum_{d=1}^{n}g(d)\\cdot S(\\lfloor\\frac{n}{d}\\rfloor)
=d=1∑n⎝⎛g(d)⋅di=1∑⌊dn⌋f(di)⎠⎞=d=1∑ng(d)⋅S(⌊dn⌋)
=
g
(
1
)
⋅
S
(
n
)
+
∑
d
=
2
n
g
(
d
)
⋅
S
(
⌊
n
d
⌋
)
,
式
中
S
(
k
)
=
∑
i
=
1
k
f
(
i
)
=g(1)\\cdot S(n)+\\sum_{d=2}^{n}g(d)\\cdot S(\\lfloor\\frac{n}{d} \\rfloor),式中S(k)=\\sum_{i=1}^{k}f(i)
=g(1)⋅S(n)+d=2∑ng(d)⋅S(⌊dn⌋),式中S(k)=i=1∑kf(i)
∴
g
(
1
)
⋅
S
(
n
)
=
∑
i
=
1
n
(
g
∗
f
)
(
i
)
−
∑
d
=
2
n
g
(
d
)
⋅
S
(
⌊
n
d
⌋
)
\\therefore \\quad g(1)\\cdot S(n)=\\sum_{i=1}^{n}(g*f)(i)-\\sum_{d=2}^{n}g(d)\\cdot S(\\lfloor\\frac{n}{d} \\rfloor)
∴g(1)⋅S(n)=i=1∑n(g∗f)(i)−d=2∑ng(d)⋅S(⌊dn⌋)
2.2 数学模型
∑ d ∣ N f ( d ) ⋅ 1 = ( f ∗ I ) ( n ) = ( I ∗ f ) ( n ) = ∑ d ∣ N 1 ⋅ f ( n d ) , 式 中 I ( n ) = 1 \\sum_{d|N}f(d)\\cdot 1 = (f*I)(n)=(I*f)(n)=\\sum_{d|N}1\\cdot f(\\frac{n}{d}) ,式中I(n)=1 d∣N∑f(d)⋅1=(f∗I)(n)=(I∗f)(n)=d∣N∑1⋅f(HDU-5608(杜教筛)