# 欧拉定理

**欧拉定理**（亦称欧拉φ定理或欧拉–费马定理）是数论中的一个结果，它断言：若 \( n \) 为正整数，\( a \) 为满足 \( \gcd(a, n) = 1 \) 的整数，则

\[ a^{\phi(n)} \equiv 1 \pmod{n}, \]

其中 \( \phi(n) \) 为欧拉函数，即满足 \( 1 \leq m < n \) 且 \( \gcd(m, n) = 1 \) 的正整数 \( m \) 的个数（并约定 \( \phi(1) = 1 \)）。<sup>[1](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)</sup> 该定理推广了费马小定理——后者是模数 \( n = p \) 为素数、\( \phi(p) = p - 1 \) 的特殊情形，此时给出 \( a^{p-1} \equiv 1 \pmod{p} \)。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup><sup> • </sup><sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 陈述 | 若 \( \gcd(a, n) = 1 \) 且 \( n > 0 \)，则 \( a^{\phi(n)} \equiv 1 \pmod{n} \)<sup>[1](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)</sup> |
| 欧拉函数 | \( \phi(n) \) 计数 1 到 \( n-1 \) 中与 \( n \) 互素的整数；它等于单位群 \( \mathbb{Z}_n^* \) 的阶<sup>[1](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)</sup><sup> • </sup><sup>[4](https://courses.csail.mit.edu/6.046/spring04/lectures/lecture8.html)</sup> |
| 素数情形 | \( \phi(p) = p - 1 \)，由此还原费马小定理 \( a^{p-1} \equiv 1 \pmod{p} \)<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup> |
| 乘积公式 | 若 \( n = p_1^{k_1} \cdots p_r^{k_r} \)，则 \( \phi(n) = n(1 - 1/p_1) \cdots (1 - 1/p_r) \)；对 \( N = pq \)，有 \( \phi(N) = (p-1)(q-1) \)<sup>[5](https://www.cs.sjsu.edu/~stamp/CS265/SecurityEngineering/chapter5_SE/RSAmath.html)</sup> |
| 逆元 | \( a^{\phi(n)-1} \) 是 \( a \) 模 \( n \) 的乘法逆元<sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup> |
| 归属 | 定理 7.3 归功于欧拉，1760 年；相关论文 E271 写于 1758 年，发表于 1763 年<sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup><sup> • </sup><sup>[6](https://scholarlycommons.pacific.edu/euler-works/271/)</sup> |
| 主要应用 | RSA 解密的正确性，其依赖于 \( ed \equiv 1 \pmod{\phi(N)} \)<sup>[5](https://www.cs.sjsu.edu/~stamp/CS265/SecurityEngineering/chapter5_SE/RSAmath.html)</sup> |

## 欧拉函数

定理中的指数由欧拉的 \( \phi \) 函数提供。对 \( n = 12 \)，与 12 互素的数为 1、5、7、11，故 \( \phi(12) = 4 \)；这四个类构成单位群 \( \mathbb{Z}_{12}^\times \)，一般地有 \( |\mathbb{Z}_n^\times| = \phi(n) \)。<sup>[1](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)</sup> 对素数 \( p \)，1 到 \( p - 1 \) 的每个整数都是单位，故 \( \phi(p) = p - 1 \)。<sup>[1](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)</sup>

两个结构性事实使 \( \phi \) 可计算。第一，对素数幂，\( \phi(p^e) = p^e - p^{e-1} = p^{e-1}(p-1) \)，因为 \( 1, \ldots, p^e \) 中 \( p \) 的倍数恰有 \( p^{e-1} \) 个。<sup>[7](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)</sup> 第二，\( \phi \) 是积性的：若 \( \gcd(m, n) = 1 \)，则 \( \phi(mn) = \phi(m)\phi(n) \)。<sup>[7](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)</sup> 两者结合给出素数幂分解 \( n = p_1^{e_1} \cdots p_k^{e_k} \) 下的乘积公式：<sup>[7](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)</sup>

\[ \phi(n) = \prod_{i=1}^{k} \left( p_i^{e_i} - p_i^{e_i - 1} \right) = n \prod_{i=1}^{k} \left( 1 - \frac{1}{p_i} \right). \]

例如，\( \phi(60) = 60 \cdot \tfrac{1}{2} \cdot \tfrac{2}{3} \cdot \tfrac{4}{5} = 16 \)。<sup>[7](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)</sup>

## 证明

标准证明将每个单位乘以 \( a \)。设 \( u_1, \ldots, u_m \)（其中 \( m = \phi(n) \)）为模 \( n \) 的全部单位。乘积 \( a u_1, \ldots, a u_m \) 两两不同（若 \( a u_i = a u_j \)，两边乘以 \( a \) 的逆元即得 \( u_i = u_j \)），且单位的乘积仍是单位，故 \( a u_1, \ldots, a u_m \) 只是 \( u_1, \ldots, u_m \) 的某个重排。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup> 将两列元素全部相乘，得

\[ a^{\phi(n)} \, u_1 \cdots u_m \equiv u_1 \cdots u_m \pmod{n}, \]

而每个 \( u_i \) 都是单位，可以约去，于是剩下 \( a^{\phi(n)} \equiv 1 \pmod{n} \)。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup><sup> • </sup><sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup>

第二个证明用群论。幂 \( 1, a, a^2, \ldots, a^{t-1} \)（其中 \( t \) 为 \( a \) 的阶）构成 \( \mathbb{Z}_N^* \) 的一个子群。由拉格朗日定理，子群的大小整除群的大小，故 \( \phi(N) = b \cdot t \) 对某整数 \( b \) 成立，于是 \( a^{\phi(N)} = (a^t)^b = 1 \pmod{N} \)。<sup>[4](https://courses.csail.mit.edu/6.046/spring04/lectures/lecture8.html)</sup> 同样的推理表明任何单位的阶都整除 \( \phi(n) \)。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup> 费马与欧拉都在群论发展之前去世，因此该定理早于它最清晰的证明。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup>

## 定理说了什么、没说什么

欧拉定理保证 \( \phi(n) \) 是一个使每个单位都回到 1 的指数，但它并未给出对特定 \( a \) 的最小这样的指数。\( a \) 的阶可能是 \( \phi(n) \) 的真因子；例如模 9 时，元素 4 的阶为 3，而 \( \phi(9) = 6 \)。<sup>[8](https://www.cs.cornell.edu/courses/cs2800/2016fa/lectures/lec25-euler.html)</sup> 该定理对与模数不互素的元素也未作任何断言：若 \( \gcd(a, n) > 1 \)，则 \( a^{\phi(n)} \not\equiv 1 \pmod{n} \)，因为这样的 \( a \) 没有乘法逆元。<sup>[9](https://math.oxford.emory.edu/site/math125/eulersTheorem/)</sup>

一个实际推论是指数约化：对单位 \( a \)，\( a \) 模 \( n \) 的幂只依赖于指数模 \( \phi(n) \) 的余数，因为 \( a^{b + k\phi(n)} = a^b \pmod{n} \)。<sup>[8](https://www.cs.cornell.edu/courses/cs2800/2016fa/lectures/lec25-euler.html)</sup> 这把巨大指数的计算化为小指数的计算。要求 \( 3^{1492} \) 的末两位十进制数字，可模 100 计算；因 \( \phi(100) = 40 \) 且 \( 1492 \equiv 12 \pmod{40} \)，问题化为 \( 3^{12} \equiv 41 \pmod{100} \)。<sup>[7](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)</sup>

该定理还提供逆元：\( a^{\phi(n)-1} \) 是 \( a \) 模 \( n \) 的逆元，可用反复平方高效计算，尽管欧几里得算法更快且无需知道 \( \phi(n) \)。<sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup><sup> • </sup><sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup>

## 历史

标准教科书引述中，该定理归功于莱昂哈德·欧拉（Leonhard Euler），日期为 1760 年。<sup>[3](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)</sup> 相关论文《*Theoremata arithmetica nova methodo demonstrata*》（Eneström 编号 E271）写于 1758 年，据雅可比称于 1758 年 6 月 8 日在柏林科学院宣读，并于 1759 年 10 月 15 日提交圣彼得堡科学院；该文于 1763 年发表在《*Novi Commentarii academiae scientiarum Petropolitanae*》第 8 卷，第 74–104 页。<sup>[6](https://scholarlycommons.pacific.edu/euler-works/271/)</sup> 文中欧拉给出了费马定理的第三个证明——正是这个证明引出了“欧拉–费马定理”之名——并证明了：当 \( \gcd(x, N) = 1 \) 时，满足 \( x^t \equiv 1 \pmod{N} \) 的最小正整数指数 \( t \) 整除 \( \varphi(N) \)，即模 \( N \) 与 \( N \) 互素的剩余类的个数；这个最小指数就是 \( x \) 模 \( N \) 的阶。<sup>[6](https://scholarlycommons.pacific.edu/euler-works/271/)</sup>

## 应用

**RSA 密码学。** RSA 解密直接依赖该定理。对 RSA 模数 \( N = pq \)，\( \mathbb{Z}_N \) 中与 \( N \) 互素的剩余个数为 \( \phi(N) = (p-1)(q-1) \)，因为除 0 以及 \( p \) 或 \( q \) 的非零倍数外，所有剩余都合格。<sup>[10](https://securitybook.eecs.berkeley.edu/chapters/lec06.html)</sup> 若加密与解密指数满足 \( ed \equiv 1 \pmod{\phi(N)} \)，则对某整数 \( k \) 有 \( ed - 1 = k\phi(N) \)，从而

\[ M^{ed} = M \cdot M^{k\phi(N)} \equiv M \pmod{N}, \]

这是对 \( M^k \) 应用欧拉定理的结果，也正是解密能恢复消息的原因。<sup>[5](https://www.cs.sjsu.edu/~stamp/CS265/SecurityEngineering/chapter5_SE/RSAmath.html)</sup> 该方案的安全性依赖于：目前不知道如何在不分解 \( N \) 的情况下由 \( N \) 计算 \( \phi(N) \)，而大数的高效分解算法尚无人知晓。<sup>[2](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)</sup> 当前的 RSA 规范（RFC 8017）则改用 \( e \cdot d \equiv 1 \pmod{\lambda(n)} \) 定义私钥指数，其中 \( \lambda(n) = \mathrm{LCM}(r_1 - 1, \ldots, r_u - 1) \) 为卡迈克尔函数，它是 \( \phi(n) \) 的一个因子，同样使每个单位的 \( \lambda(n) \) 次幂等于 1。<sup>[11](https://www.rfc-editor.org/info/rfc8017/)</sup>

**素性测试。** 当 \( N \) 为素数时，\( \phi(N) = N - 1 \)，故对每个单位 \( a \) 都有 \( a^{N-1} \equiv 1 \pmod{N} \)；这是费马测试的基础。<sup>[4](https://courses.csail.mit.edu/6.046/spring04/lectures/lecture8.html)</sup> 逆命题不成立：称为卡迈克尔数的合数（最小者为 561）对每个与 \( N \) 互素的 \( a \) 都满足 \( a^{N-1} \equiv 1 \pmod{N} \)，因此通过费马测试并不能证明素性。<sup>[4](https://courses.csail.mit.edu/6.046/spring04/lectures/lecture8.html)</sup> 欧拉判别法指出，对奇素数 \( p \) 有 \( a^{(p-1)/2} \equiv (a/p) \pmod{p} \)，其中 \( (a/p) \) 为勒让德符号；由此得到更强的欧拉测试，能通过该测试的合数称为欧拉伪素数。<sup>[12](https://www.maths.cam.ac.uk/undergrad/catam/II/15pt1.pdf)</sup>

## References

1. [Section 11.3, Euler's Theorem, Abstract Algebra: Theory and Applications (UTK)](https://web.math.utk.edu/~dcartwr1/iaawa/section-fermat-euler.html)
2. [The Order of a Unit, Number Theory notes, Ben Lynn, Stanford](https://crypto.stanford.edu/pbc/notes/numbertheory/order.html)
3. [Euler's Theorem, MATH1001 Introduction to Number Theory, University of Southampton](https://www.southampton.ac.uk/~wright/1001/eulers-theorem.html)
4. [6.046 Lecture 8, MIT CSAIL (2004)](https://courses.csail.mit.edu/6.046/spring04/lectures/lecture8.html)
5. [The Mathematics behind RSA, CS 265, San Jose State University](https://www.cs.sjsu.edu/~stamp/CS265/SecurityEngineering/chapter5_SE/RSAmath.html)
6. [Theoremata arithmetica nova methodo demonstrata (E271), Euler Archive, University of the Pacific](https://scholarlycommons.pacific.edu/euler-works/271/)
7. [Chapter 6, Euler's Function, MATH1001, University of Southampton](https://personal.soton.ac.uk/jhr/math1001/chapter-euler.html)
8. [Lecture 25: Euler's theorem, CS 2800, Cornell University](https://www.cs.cornell.edu/courses/cs2800/2016fa/lectures/lec25-euler.html)
9. [Euler's Theorem, Math 125, Emory University](https://math.oxford.emory.edu/site/math125/eulersTheorem/)
10. [RSA Signatures, The Structure of Secure Systems, UC Berkeley](https://securitybook.eecs.berkeley.edu/chapters/lec06.html)
11. [RFC 8017: PKCS #1: RSA Cryptography Specifications Version 2.2, RFC Editor](https://www.rfc-editor.org/info/rfc8017/)
12. [15.1 Primality Tests, CATAM Part II, University of Cambridge (2023)](https://www.maths.cam.ac.uk/undergrad/catam/II/15pt1.pdf)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Number theory › Elementary number theory › Orders, primitive roots, and the multiplicative group mod n

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/eulers-theorem

English original: https://www.edgepedia.org/eulers-theorem
