传送门
蒟蒻的第一道单位根反演,感觉还挺好用的
考虑对于每个复读机列出生成函数:
F = ∑ i ≥ 0 [ d ∣ i ] x i i ! F = ∑ i ≥ 0 x i i ! ∑ j = 1 d ( ω d i ) j d F = 1 d ∑ j = 1 d ∑ i ≥ 0 ( ω d j x ) i F = 1 d ∑ i = 1 d e ω d i x A n s = F k = 1 d k ( ∑ i = 1 d e ω d i x ) k \begin{aligned}F=&\sum_{i\ge0}[d|i]\frac{x^i}{i!}\\F=&\sum_{i\ge0}\frac{x^i}{i!}\frac{\sum_{j=1}^d(\omega_d^i)^j}{d}\\F=&\frac1d\sum_{j=1}^d\sum_{i\ge0}(\omega_d^jx)^i\\F=&\frac1d\sum_{i=1}^de^{\omega_d^ix}\\Ans=&F^k=\frac1{d^k}(\sum_{i=1}^de^{\omega_d^ix})^k\end{aligned} F=F=F=F=Ans=i≥0∑[d∣i</