# 乘法算法

乘法算法是计算两个数或多项式的乘积的步骤。这门学科的范围从小学教授的竖式长乘法，历经古代的加倍减半法和机械辅助工具，一直到分治算法与基于变换的算法——后者在 n 位输入上的运行时间从经典的 O(n²) 降至 O(n log n)。

| 关键事实 | 详情 |
|---|---|
| 竖式乘法的成本 | 两个 n 位数的长乘法大约需要 n² 次单个数字的乘法，时间复杂度为 O(n²)<sup>[1](https://mathworld.wolfram.com/LongMultiplication.html)</sup> |
| 首次改进 | 卡拉楚巴算法发现于 1960 年，将成本从 O(n²) 降至约 O(n^1.59)，因为 log₂ 3 ≈ 1.585<sup>[2](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)</sup><sup> • </sup><sup>[3](https://cs.uwaterloo.ca/~cbright/cdm/07-fast-multiplication-and-the-discrete-fourier-transform-ran.html)</sup> |
| 基于 FFT 的时代 | 舍恩哈格-施特拉森算法的运行时间为 O(n log n log log n)，在超过 35 年的时间里一直是已知最快的整数乘法方法<sup>[4](https://epubs.siam.org/doi/10.1137/070711761)</sup> |
| 菲雷尔与 DKSS | 菲雷尔算法使用复数算术达到 M log M · 2^O(log* M)；De、Kurur、Saha 和 Saptharishi 使用模算术给出了一个复杂度相同的相关算法<sup>[5](https://link.springer.com/article/10.1007/s00200-022-00593-0)</sup> |
| 当前界 | 哈维与范德霍芬 2021 年的算法在 O(n log n) 次位操作内完成两个 n 位整数的乘法，证实了舍恩哈格与施特拉森 1971 年的猜想<sup>[6](https://annals.math.princeton.edu/2021/193-2/p04)</sup> |
| 古代方法 | 埃及方法记载于约公元前 1650 年的莱因德数学纸草书中，仅用加倍、减半和加法进行乘法<sup>[7](https://www.youtube.com/watch?v=qHXsKyVSPOU)</sup> |
| 机械辅助 | 纳皮尔算筹（骨筹）发表于 1617 年的《算筹术》，用带数字的筹棒将乘法化为加法<sup>[8](https://mathshistory.st-andrews.ac.uk/Extras/Napier_rods/)</sup> |

## 竖式长乘法

长乘法是通常教给小学生的方法。两个数竖直书写，最低有效位对齐；算法用乘数的最低有效位乘以被乘数，得到一个部分积，然后对所有更高位重复此过程，每个部分积与其对应的数字右对齐，再将结果相加<sup>[1](https://mathworld.wolfram.com/LongMultiplication.html)</sup>。这个方法之所以成立，是因为乘法对加法满足分配律：用 56 乘 384，意味着乘以 6、乘以 50，然后相加<sup>[1](https://mathworld.wolfram.com/LongMultiplication.html)</sup>。

成本按二次方增长。两个 n 位数的乘法大约需要 n² 次乘法运算，因此时间复杂度为 O(n²)<sup>[1](https://mathworld.wolfram.com/LongMultiplication.html)</sup>。同样的方法可以推广到多项式，此时在相加部分积之前，需要注意对齐变量和指数相同的项<sup>[1](https://mathworld.wolfram.com/LongMultiplication.html)</sup>。

## 古代与民间方法

**埃及乘法**只需要加倍、减半和相加的能力。一列用向下取整的除法减半，另一列加倍；与奇数减半值对应的加倍项被相加。该方法记载于约公元前 1650 年的莱因德数学纸草书中，本质上就是二进制乘法——只要把乘数和被乘数转换为二进制<sup>[7](https://www.youtube.com/watch?v=qHXsKyVSPOU)</sup>。埃及版本没有使用减半操作或奇偶性，但确实使用了比较<sup>[9](https://avys.omu.edu.tr/storage/app/public/selcuk.aslan/106988/Algorithms_OpenAccess.pdf)</sup>。

同一算法在 19 世纪的俄罗斯被重新发现，并在未受教育的农民中日常使用而流传下来，因此被称为俄罗斯农民乘法（也称埃塞俄比亚农民乘法）<sup>[10](https://www.cs.cas.cz/portal/AlgoMath/NumberTheory/Arithmetics/Multiplication/PeasantMultiplication.htm)</sup>。由于它不依赖位值记数法，因此适用于任何合理的表示；每次操作至多花费 O(log max{x, y}) 次单个数字的操作，总运行时间为 O(log x · log y)<sup>[9](https://avys.omu.edu.tr/storage/app/public/selcuk.aslan/106988/Algorithms_OpenAccess.pdf)</sup>。该方法的一个变体直到现代仍在俄罗斯、埃塞俄比亚、阿拉伯世界和近东地区使用<sup>[11](https://www.shastacoe.org/uploaded/Dept/is/sci-math/scmp_resources/word/pdf/35_MultAlgorithms.pdf)</sup>。

**纳皮尔算筹。** 1617 年，对数的发明者约翰·纳皮尔（John Napier）出版了《算筹术》，描述了让计算者仅用加法就能做乘法的“计数筹棒”。每根筹棒是一块矩形条，四个面上刻着某个数字的倍数，两位数的乘积用对角线分开，以便沿对角线相加进位。要用 567 乘 4138，把标头为 4、1、3、8 的四根筹棒并排放置，读出第 5、6、7 行并沿对角线进位，再把错位后的结果相加，得到 2346246<sup>[8](https://mathshistory.st-andrews.ac.uk/Extras/Napier_rods/)</sup>。这些用象牙制成的筹棒被昵称为“纳皮尔骨筹”，在英国和欧洲大陆流行起来，《算筹术》也被译成意大利语和荷兰语<sup>[8](https://mathshistory.st-andrews.ac.uk/Extras/Napier_rods/)</sup>。

## 卡拉楚巴算法

1960 年，还是一名学生的阿纳托利·卡拉楚巴（Anatoly Karatsuba）找到了第一个超越竖式乘法二次运行时间的算法，并在莫斯科国立大学由安德烈·柯尔莫哥洛夫（Andrey Kolmogorov）主持的讨论班上报告了它；柯尔莫哥洛夫把功劳归于卡拉楚巴，并于 1962 年在《苏联科学院院报》上发表了一篇相关记述<sup>[3](https://cs.uwaterloo.ca/~cbright/cdm/07-fast-multiplication-and-the-discrete-fourier-transform-ran.html)</sup>。A. 卡拉楚巴与尤·奥夫曼（Yu. Ofman）的论文《用自动计算机做多位数乘法》发表于《苏联科学院报告》，第 145 卷第 2 期，第 293–294 页，1962 年 2 月 9 日收稿，由 A. N. 柯尔莫哥洛夫提交<sup>[12](https://www.mathnet.ru/php/archive.phtml?jrnid=dan&option_lang=eng&paperid=26729&wshow=paper)</sup>。

其思想是把每个因子一分为二，重新整理代数式，使三次半规模的乘法取代四次。记 A = A₁xᵐ + A₀，B = B₁xᵐ + B₀，朴素的分解 AB = A₁B₁xⁿ + (A₁B₀ + A₀B₁)xᵐ + A₀B₀ 需要四个乘积，但恒等式 (A₁ + A₀)(B₁ + B₀) = A₁B₁ + (A₁B₀ + A₀B₁) + A₀B₀ 用一个和的乘积就恢复了中间项，于是得到三次半规模对象的乘法外加 O(n) 次加法<sup>[3](https://cs.uwaterloo.ca/~cbright/cdm/07-fast-multiplication-and-the-discrete-fourier-transform-ran.html)</sup>。递推式 T(n) = 3·T(n/2) + O(n) 的解为 n^(log₂ 3) ≈ n^1.585，因此卡拉楚巴方法在 O(n^1.59) 次系数运算内完成多项式乘法，该方法也适用于整数，并在实践中行之有效<sup>[3](https://cs.uwaterloo.ca/~cbright/cdm/07-fast-multiplication-and-the-discrete-fourier-transform-ran.html)</sup><sup> • </sup><sup>[2](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)</sup>。

更快的推广是图姆-库克算法<sup>[5](https://link.springer.com/article/10.1007/s00200-022-00593-0)</sup>，它把因子作为多项式在若干点上求值，逐点相乘，然后插值。在实践中，实现往往采用混合方案：对小输入使用朴素算法，超过某个阈值后切换到卡拉楚巴算法<sup>[13](https://doi.org/10.1016/j.jsc.2015.03.001)</sup>。

## 基于变换的算法

离散傅里叶变换把多项式从系数形式转换为单位根（z^n=1 的解，使快速傅里叶变换成为可能）处的取值，在那里乘法是逐点进行的，而快速傅里叶变换（FFT）能高效地计算该变换。将卡拉楚巴乘法与 FFT 结合，得到位复杂度为 O(M(log M)^(2+ε)) 的算法<sup>[5](https://link.springer.com/article/10.1007/s00200-022-00593-0)</sup>。这些快速方法只有在底层环中存在合适的单位根时才有效<sup>[2](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)</sup>。

**舍恩哈格-施特拉森。** 1971 年，阿诺德·舍恩哈格（Arnold Schönhage）和福尔克·施特拉森（Volker Strassen）展示了如何构造“虚拟”单位根，得到 O(n log n log log n) 的乘法成本<sup>[2](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)</sup>。在超过 35 年的时间里，这是已知最快的整数乘法方法<sup>[4](https://epubs.siam.org/doi/10.1137/070711761)</sup>，并且至今仍是实践中大整数乘法事实上的标准<sup>[14](https://arxiv.org/abs/1503.04955)</sup>。

**菲雷尔及其后继者。** 马丁·菲雷尔（Martin Fürer）的算法渐近更快，计算复杂度为 M log M · 2^O(log* M)，其中 log* M 是迭代对数；它使用复数算术。De、Kurur、Saha 和 Saptharishi 使用模算术给出了一个复杂度相同的相关算法<sup>[5](https://link.springer.com/article/10.1007/s00200-022-00593-0)</sup>。菲雷尔型算法依赖于基域中存在合适的单位根，因此对于一般多项式乘法，它们没有直接的代数类比<sup>[15](https://doi.org/10.1145%2F3505584)</sup>。

## O(n log n) 界

2021 年，新南威尔士大学的大卫·哈维（David Harvey）与法国国家科学研究中心、巴黎综合理工学院的约里斯·范德霍芬（Joris van der Hoeven）发表了一个算法，在 O(n log n) 次位操作内计算两个 n 位整数的乘积，证实了舍恩哈格与施特拉森 1971 年的猜想。分析在多带图灵机模型中进行，整数采用二进制表示<sup>[6](https://annals.math.princeton.edu/2021/193-2/p04)</sup>。该算法的关键要素是一个“高斯重采样”步骤，它把整数乘法转化为一组复数域上的多维离散傅里叶变换，每个变换各维度的大小都是 2 的幂；随后用努斯鲍默的快速多项式变换来计算它们<sup>[6](https://annals.math.princeton.edu/2021/193-2/p04)</sup>。这是已知渐近最快的乘法算法<sup>[5](https://link.springer.com/article/10.1007/s00200-022-00593-0)</sup>。

一个下界归约表明这个问题确实很难：哈维与范德霍芬证明了矩阵转置可归约到整数乘法，因此如果转置一个 n × n 二进制矩阵在图灵机上需要 Ω(n² log n) 步，那么两个 n 位整数相乘就需要 Ω(n log n) 步<sup>[16](https://arxiv.org/abs/2503.22848)</sup>。

## 实际应用

渐近快速的方法在计算机科学中是标准工具，但通用计算机代数系统通常只实现经典方法，有时也实现卡拉楚巴算法——对于相当小的数和多项式，这已经足够。快速算术对于高性能任务不可或缺，例如分解大多项式、寻找素数和孪生素数，以及计算 π 的数十亿位数字或黎曼 zeta 函数的数十亿个根<sup>[2](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)</sup>。在硬件层面，专用的并行乘法器芯片可以把乘法从处理器卸载出去；一块围绕 1980 年代 TRW MPY12HJ 并行乘法器自制的 ISA 卡，使早期 Intel 8086 和 8088 系统上的整数乘法快了约 2.5 倍<sup>[17](https://www.tomshardware.com/pc-components/cpus/hobbyist-builds-a-homebrew-intel-8086-isa-accelerator-card-makers-project-improves-integer-multiplication-on-these-retro-systems-by-250-percent)</sup>。

## References

1. [Long Multiplication, Wolfram MathWorld](https://mathworld.wolfram.com/LongMultiplication.html)
2. [Joachim von zur Gathen and Jürgen Gerhard, "Fast multiplication", Chapter 8 of *Modern Computer Algebra*, Cambridge University Press](https://www.cambridge.org/core/books/abs/modern-computer-algebra/fast-multiplication/D3F25E526A75187A1917F91A992DB4C6)
3. [Fast Multiplication and the Discrete Fourier Transform, course notes, University of Waterloo](https://cs.uwaterloo.ca/~cbright/cdm/07-fast-multiplication-and-the-discrete-fourier-transform-ran.html)
4. [Faster Integer Multiplication, SIAM Journal on Computing](https://epubs.siam.org/doi/10.1137/070711761)
5. [Algorithmic counting of nonequivalent compact Huffman codes, Applicable Algebra in Engineering, Communication and Computing, Springer](https://link.springer.com/article/10.1007/s00200-022-00593-0)
6. [David Harvey and Joris van der Hoeven, "Integer multiplication in time O(n log n)", Annals of Mathematics 193 (2021), 563–617](https://annals.math.princeton.edu/2021/193-2/p04)
7. [How Ancient Egyptians Multiplied Numbers Quickly (aka Russian Peasant Multiplication), MindYourDecisions](https://www.youtube.com/watch?v=qHXsKyVSPOU)
8. [Napier's rods, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Extras/Napier_rods/)
9. [Algorithms, open-access textbook (section 0.2, Multiplication)](https://avys.omu.edu.tr/storage/app/public/selcuk.aslan/106988/Algorithms_OpenAccess.pdf)
10. [Peasant Multiplication, AlgoMath](https://www.cs.cas.cz/portal/AlgoMath/NumberTheory/Arithmetics/Multiplication/PeasantMultiplication.htm)
11. [Egyptian Multiplication, Shasta County Office of Education resource](https://www.shastacoe.org/uploaded/Dept/is/sci-math/scmp_resources/word/pdf/35_MultAlgorithms.pdf)
12. [A. Karatsuba, Yu. Ofman, "Multiplication of many-digital numbers by automatic computers", Dokl. Akad. Nauk SSSR 145:2 (1962), 293–294](https://www.mathnet.ru/php/archive.phtml?jrnid=dan&option_lang=eng&paperid=26729&wshow=paper)
13. [A simple and fast online power series multiplication and its analysis, Journal of Symbolic Computation](https://doi.org/10.1016/j.jsc.2015.03.001)
14. [Fast Multiplication of Large Integers: Implementation and Analysis of the DKSS Algorithm, arXiv](https://arxiv.org/abs/1503.04955)
15. [Polynomial Multiplication over Finite Fields in Time O(n log n), Journal of the ACM](https://doi.org/10.1145%2F3505584)
16. [David Harvey and Joris van der Hoeven, "Integer multiplication is at least as hard as matrix transposition", arXiv](https://arxiv.org/abs/2503.22848)
17. [Hobbyist builds a homebrew Intel 8086 ISA accelerator card, Tom's Hardware](https://www.tomshardware.com/pc-components/cpus/hobbyist-builds-a-homebrew-intel-8086-isa-accelerator-card-makers-project-improves-integer-multiplication-on-these-retro-systems-by-250-percent)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Arithmetic and number systems › Elementary and formal arithmetic › Elementary arithmetic operations

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/multiplication-algorithm

English original: https://www.edgepedia.org/multiplication-algorithm
