# 狄利克雷卷积

**狄利克雷卷积**是定义在算术函数（即定义在正整数上的函数）上的一种二元运算，其中在 n 处的值将两个函数在 n 的所有除数对上的值结合起来：对于算术函数 f 和 g，

\[ (f*g)(n) = \sum_{d \mid n} f(d)\, g(n/d), \]

其中求和遍历 n 的正除数 d。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> 它以德国数学家彼得·古斯塔夫·勒热纳·狄利克雷（Peter Gustav Lejeune Dirichlet）命名。<sup>[2](https://shanechern.github.io/Math3070/Fall22/Ch14.pdf)</sup> 该运算编码了除数结构，是莫比乌斯反演、积性函数研究以及狄利克雷级数乘法的代数骨架。<sup>[3](https://dlmf.nist.gov/27.5)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | \( (f*g)(n) = \sum_{d \mid n} f(d)\, g(n/d) \)，对 n 的正除数 d 求和<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> |
| 代数结构 | 算术函数在逐点加法和狄利克雷卷积下构成一个有单位元的交换环<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> |
| 单位元 | 函数 ε，满足 ε(1) = 1 且其余情形 ε(n) = 0（等价地写作 ⌊1/n⌋），是单位元<sup>[3](https://dlmf.nist.gov/27.5)</sup><sup> • </sup><sup>[4](https://senior-stack.uz/Roadmap/Data/datastructures-and-algorithms/19-number-theory/04-dirichlet-linear-sieve/professional/)</sup> |
| 逆元 | f 有狄利克雷逆当且仅当 f(1) ≠ 0；常数函数 1 的逆是莫比乌斯函数 μ<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> |
| 积性函数 | 积性函数构成 f(1) ≠ 0 的函数群的一个子群<sup>[3](https://dlmf.nist.gov/27.5)</sup> |
| 狄利克雷级数 | 若 F(s) 生成 f，G(s) 生成 g，则乘积 F(s)G(s) 生成 f*g<sup>[3](https://dlmf.nist.gov/27.5)</sup> |
| 历史 | 这种形式的除数和恒等式从算术函数理论的早期就已出现；刘维尔（Liouville）于 1857 年发表了长列表，而二元运算的观点由 E.T. 贝尔（E.T. Bell）和 M. 奇波拉（M. Cipolla）于 1915 年引入<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> |

## 基本性质

卷积满足交换律和结合律，由 ε(1) = 1 及 n > 1 时 ε(n) = 0 定义的函数 ε 起单位元的作用，因为对每个 n 都有 \( (f*\epsilon)(n) = f(n) \)。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup><sup> • </sup><sup>[4](https://senior-stack.uz/Roadmap/Data/datastructures-and-algorithms/19-number-theory/04-dirichlet-linear-sieve/professional/)</sup> 在逐点加法和此乘法下，算术函数的集合构成一个有单位元的交换环。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup>

**逆元。** 算术函数 f 拥有狄利克雷逆——即满足 f*f<sup>−1</sup> = ε 的函数 f<sup>−1</sup>——当且仅当 f(1) ≠ 0。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> DLMF 给出了这一事实的群论形式：满足 f(1) ≠ 0 的数论函数集合在狄利克雷乘法下构成一个阿贝尔群，以 ⌊1/n⌋ 为单位元。<sup>[3](https://dlmf.nist.gov/27.5)</sup> 最重要的实例是：常数函数 1（在每个 n 处取值均为 1）的狄利克雷逆是莫比乌斯函数 μ，这等价于恒等式 \( \sum_{d \mid n} \mu(d) = \lfloor 1/n \rfloor \)。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup><sup> • </sup><sup>[3](https://dlmf.nist.gov/27.5)</sup>

**积性。** 两个积性函数的狄利克雷卷积是积性的，且积性函数构成卷积可逆函数群的子群。<sup>[3](https://dlmf.nist.gov/27.5)</sup> 这正是卷积成为算术函数自然乘积的原因：它保持并组织除数结构。<sup>[5](https://a-warded.org/open-book/university-number-theory/lesson-6)</sup>

## 标准例子

与常数函数 1 的卷积将熟悉的函数表示为除数和：

- \( (\mathbf{1} * \mathbf{1})(n) = \tau(n) \)，即 n 的除数个数。<sup>[6](https://www.youtube.com/watch?v=sF9JI5BdFaE)</sup>
- \( (\varphi * \mathbf{1})(n) = N(n) \)，其中 φ 是欧拉函数，N(n) = n；等价地 \( \sum_{d \mid n} \varphi(d) = n \)。<sup>[7](https://www.math.gordon.edu/~kcrisman/mat338/section-108.html)</sup>
- \( (\mu * \mathbf{1})(n) = \epsilon(n) \)，即上述反演恒等式。<sup>[8](https://www.cs.purdue.edu/homes/luo401/cp/dirichlet-convolution.html)</sup>

美国数学会的教材还将卷积 \( \mathbf{1} * \varphi \) 作为该方法的演算示例加以强调。<sup>[9](https://www.ams.org/bookstore/pspdf/gsm-160-prev.pdf)</sup>

## 莫比乌斯反演

建立在卷积之上的核心定理是莫比乌斯反演公式。用卷积记号表述为：若 f = g*𝟏，则 g = f*μ；写开来即，

\[ f(n) = \sum_{d \mid n} g(d) \quad \Longleftrightarrow \quad g(n) = \sum_{d \mid n} \mu(d)\, f(n/d). \]

<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup><sup> • </sup><sup>[7](https://www.math.gordon.edu/~kcrisman/mat338/section-108.html)</sup> 证明归结为恒等式 μ*𝟏 = ε：将反演公式中的 f 替换为除数和后，每个 g(e) 都乘以 \( \sum_{d \mid n/e} \mu(d) \)，除非 e = n，否则该因子为零。<sup>[7](https://www.math.gordon.edu/~kcrisman/mat338/section-108.html)</sup> 该公式使人能从函数的除数和恢复该函数，这正是从已知算术函数产生新算术函数的方式。<sup>[7](https://www.math.gordon.edu/~kcrisman/mat338/section-108.html)</sup>

## 与狄利克雷级数的关系

若狄利克雷级数 \( F(s) = \sum_{n \ge 1} f(n)/n^{s} \) 生成 f，\( G(s) \) 生成 g，则乘积 \( F(s)G(s) \) 生成卷积 f*g。<sup>[3](https://dlmf.nist.gov/27.5)</sup> 这一对应将函数间的恒等式转化为级数间的恒等式。例如，方程 \( \zeta(s) \cdot (1/\zeta(s)) = 1 \) 等价于卷积恒等式 \( \sum_{d \mid n} \mu(d) = \lfloor 1/n \rfloor \)。<sup>[3](https://dlmf.nist.gov/27.5)</sup>

## 推广

两种经典变体放宽了除数和的条件。E. 科恩（E. Cohen）定义了幺正卷积，

\[ (f \otimes g)(n) = \sum_{d \,\|\, n} f(d)\, g(n/d), \]

其中求和遍历 n 的幺正除数，即满足 \( \mathrm{hcf}(d, n/d) = 1 \) 的正除数 d。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> W. 纳尔凯维奇（W. Narkiewicz）发展了更一般的卷积 \( (f *_A g)(n) = \sum_{d \in A(n)} f(d)\, g(n/d) \)，其中对每个 n，A(n) 是 n 的正除数的一个子集；《数学百科全书》所引文献中可找到关于此类算术函数二元运算的综述。<sup>[1](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)</sup> 冯·曼戈尔特函数与除数函数的卷积也出现在当前研究中，例如与随机矩阵分布相关的 \( \mathbb{F}_q[T] \) 上的函数域类似物。<sup>[10](https://arxiv.org/abs/2107.01437)</sup>

## 计算用途

在算法数论和竞赛编程中，狄利克雷卷积是计算积性函数 f 的部分和 \( s_f(n) = \sum_{i=1}^{n} f(i) \) 之技术的基础。若已知一个伴随函数 g，使得 g 及 f*g 的部分和易于求值，则恒等式

\[ s_{f*g}(n) = g(1)\, s_f(n) + \sum_{d=2}^{n} g(d)\, s_f(\lfloor n/d \rfloor) \]

使人能递归地解出 \( s_f(n) \)。由于 \( \lfloor n/d \rfloor \) 至多取 \( 2\sqrt{n} \) 个不同值，每步代价为 \( O(\sqrt{n}) \)，再用哈希表记忆化 \( s_f(\lfloor n/i \rfloor) \) 的值，总代价为 \( O(n^{3/4}) \)。用线性筛预计算前 \( n^{2/3} \) 个值可将总复杂度降至 \( O(n^{2/3}) \)。<sup>[8](https://www.cs.purdue.edu/homes/luo401/cp/dirichlet-convolution.html)</sup> 该技术起源于 Project Euler 问题，适用于诸如计数互素对或在 \( [1, n] \) 中的对上求最大公约数与最小公倍数之和等求和问题。<sup>[8](https://www.cs.purdue.edu/homes/luo401/cp/dirichlet-convolution.html)</sup>

## References

1. [Dirichlet convolution, Encyclopedia of Mathematics (original article by Pentti Haukkanen)](https://encyclopediaofmath.org/wiki/Dirichlet_convolution)
2. [14.3 Dirichlet convolutions, Math 3070 course notes, Shane Chern](https://shanechern.github.io/Math3070/Fall22/Ch14.pdf)
3. [DLMF §27.5 Inversion Formulas, NIST Digital Library of Mathematical Functions](https://dlmf.nist.gov/27.5)
4. [Dirichlet Convolution and the Ring of Arithmetic Functions, Senior Stack](https://senior-stack.uz/Roadmap/Data/datastructures-and-algorithms/19-number-theory/04-dirichlet-linear-sieve/professional/)
5. [Arithmetic Functions and Multiplicativity, A-Warded University Number Theory](https://a-warded.org/open-book/university-number-theory/lesson-6)
6. [Dirichlet Convolution Explained, Thinking In Math lecture notes](https://www.youtube.com/watch?v=sF9JI5BdFaE)
7. [Section 23.2 New Arithmetic Functions from Old, Number Theory (Gordon College, MAT 338)](https://www.math.gordon.edu/~kcrisman/mat338/section-108.html)
8. [Dirichlet Convolution, competitive programming notes, Purdue University](https://www.cs.purdue.edu/homes/luo401/cp/dirichlet-convolution.html)
9. [Graduate Studies in Mathematics 160, preview chapter, American Mathematical Society](https://www.ams.org/bookstore/pspdf/gsm-160-prev.pdf)
10. [Kuperberg, V., Lalín, M. (2021). Sums of divisor functions and von Mangoldt convolutions in F_q[T] leading to symplectic distributions. arXiv:2107.01437](https://arxiv.org/abs/2107.01437)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Elementary number theory › Arithmetic functions

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/dirichlet-convolution

English original: https://www.edgepedia.org/dirichlet-convolution
