单位根反演
式子
[[n|k]=dfrac 1 n sumlimits_{i=0}^{n-1}omega^{ik}_n
]
证明有亿丶简单,这里就不放了
应用
((1))
对于 ([a=bpmod n]) 这个东西,我们可以发现就是在问你 (a) 与 (b) 是否模 (n) 同余
所以
[[a=bpmod n]Rightarrow[n|(a-b)]
]
于是就可以直接算了
[[n|(a-b)]=dfrac 1 nsumlimits_{i=0}^{n-1}omega_{n}^{ia-ib}
]
LOJ6485. LJJ 学二项式定理
傻逼题
[egin{align*}
dfrac 1 4sumlimits_{i=0}^ninom{n}{i}s^isumlimits_{j=0}^3[4|(i-j)]a_j&=
dfrac 1 4sumlimits_{i=0}^ninom{n}{i}s^isumlimits_{j=0}^3a_jsumlimits_{k=0}^3w^{ik}_4w^{-jk}_4
\
&=dfrac 1 4sumlimits_{i=0}^nsumlimits_{j=0}^3sumlimits_{k=0}^3inom n is^ia_jw^{ik}_4w^{-jk}_4
\
&=dfrac 1 4sumlimits_{j=0}^3a_jsumlimits_{k=0}^3w^{-jk}_4(sw^k_4+1)^n
end{align*}
]
P5591 小猪佩奇学数学
不难题
以下设 (m=998244353)
[egin{align*}
sumlimits_{i=0}^np^iinom n ileftlfloordfrac i k
ight
floor&=dfrac 1 k sumlimits_{i=0}^np^iinom n i(i-imod m)
\
&=dfrac 1 ksumlimits_{i=0}^np^iinom n ii-sumlimits_{i=0}^np^iinom n iimod m
\
&=dfrac 1 knp(p+1)^{n-1}-sumlimits_{i=0}^np^iinom n isumlimits_{j=0}^{k-1}j[imod k=j]
end{align*}
]
我们对式子的右面进行讨论
[egin{align*}
sumlimits_{i=0}^np^iinom n isumlimits_{j=0}^{k-1}j[imod k=j]&=dfrac 1 ksumlimits_{i=0}^np^iinom n isumlimits_{j=0}^{k-1}jsumlimits_{q=0}^{k-1}w^{iq}_kw^{-jq}_k
\
&=dfrac 1 ksumlimits_{j=0}^{k-1}jsumlimits_{q=0}^{k-1}w^{-jq}_k(pw^q_k+1)^n
ag{1}
\
&=dfrac 1 ksumlimits_{q=0}^{k-1}(pw^q_k+1)^nsumlimits_{j=0}^{k-1}jw^{-jq}_k
end{align*}
]
笔者推式子到 ((1)) 处时,以为本题已经结束了,但是随后发现直接计算是 (O(k^2)) 的
于是将杂项划到一起,发现这个东西有很强的性质
我们用一个直观的形式做扰动
于是设:
[S_n=sumlimits_{i=0}^{n-1}ix^i
]
此时就有:
[egin{align*}
S_n+nx^n&=xsumlimits_{i=1}^nix^{i-1}
\
&=xsumlimits_{i=1}^n(i+1)x^i
\
&=xS_n+xdfrac{1-x^n}{1-x}
\
1-x&=dfrac{xfrac{1-x^n}{1-x}-nx^n}{1-x}
\
S_n&=xfrac{1-x^n}{(1-x)^2}-dfrac{nx^n}{1-x}
end{align*}
]
当 (x=1) 时就有 (S_n=dfrac{n(n-1)}{2})
于是就可以直接做了
[sumlimits_{q=0}^{k-1}(pw^q_k+1)^nsumlimits_{j=0}^{k-1}jw^{-jq}_k=
egin{cases}
sumlimits_{q=0}^{k-1}frac{k}{w_{k}^{k-q}-1}(pw^q_k+1)^n&x
e 1
\
sumlimits_{q=0}^{k-1}frac{k(k-1)}2(pw^q_k+1)^n&x=1
end{cases}
]