“二次剩余的 Legendre 符号经互反律可沿 Euclidean 算法式递归快速计算,从而高效判定二次同余是否可解。它支撑平方同余求解、素数在二次域中的分解、Gauss 和与若干密码构造,…”
形式陈述 ​
对整数
且
反复用
直觉
用较小余数替换较大数不会改变公共因子,却使规模严格下降。终止性来自自然数不能无限下降,回代则保留每个余数对原输入的线性表达。Euclid 算法不断用余数替换较大的数,因为共同约数在这一步完全不变:
例子与边界
计算
故最大公因数为
推论与应用
欧几里得算法用于约分、模逆、CRT 拼接、RSA 密钥运算和有理重构。算法计算 最大公因数,扩展版本还构造 Bézout 等式,从而求模逆、解线性同余并支撑 整数中国剩余定理。其“带余除法 + 范数下降”模式推广到 Euclid 整环 和多项式环。
参考资料
- Kenneth Ireland and Michael Rosen, A Classical Introduction to Modern Number Theory, 2nd ed., Springer, 1990,Ch. 1, Euclidean algorithm and continued remainders。
- Ivan Niven, Herbert S. Zuckerman, and Hugh L. Montgomery, An Introduction to the Theory of Numbers, 5th ed., Wiley, 1991,Ch. 1, Euclidean and extended Euclidean algorithms。