⁻¹ 模逆元计算器(扩展欧几里得,支持大整数)Modular Inverse Calculator (Extended Euclid, Big Integers)
求 a 在模 m 下的乘法逆元 x,使 a·x ≡ 1 (mod m),用扩展欧几里得算法,支持负数和任意大的整数,列出每一步并验证结果;不互质时给出最大公约数。本地处理。Find the multiplicative inverse x of a modulo m, so that a·x ≡ 1 (mod m), with the extended Euclidean algorithm. Negative and arbitrarily large integers work; every step is listed and the answer is checked, and if a and m are not coprime the gcd is shown. Processed locally.
使用说明与常见问题How-to & FAQ
「模逆元计算器(扩展欧几里得,支持大整数)」是什么?What is the Modular Inverse Calculator (Extended Euclid, Big Integers) tool?
求 a 在模 m 下的乘法逆元 x,使 a·x ≡ 1 (mod m),用扩展欧几里得算法,支持负数和任意大的整数,列出每一步并验证结果;不互质时给出最大公约数。本地处理。Find the multiplicative inverse x of a modulo m, so that a·x ≡ 1 (mod m), with the extended Euclidean algorithm. Negative and arbitrarily large integers work; every step is listed and the answer is checked, and if a and m are not coprime the gcd is shown. Processed locally.
如何使用「模逆元计算器(扩展欧几里得,支持大整数)」?How do I use the Modular Inverse Calculator (Extended Euclid, Big Integers) tool?
在「模逆元计算器(扩展欧几里得,支持大整数)」中,填写「整数 a」、「模 m(≥ 2)」等参数,结果会随输入实时计算并显示在下方。In the Modular Inverse Calculator (Extended Euclid, Big Integers): Fill in "Integer a", "Modulus m (2 or more)"; results are recalculated instantly as you type.
模逆元是什么?What is a modular inverse?
a 在模 m 下的逆元 x 满足 a·x ≡ 1 (mod m),相当于在模运算里做“除以 a”。例如 3 × 4 = 12 ≡ 1 (mod 11),所以 3 模 11 的逆元是 4。The inverse x of a modulo m satisfies a·x ≡ 1 (mod m); it plays the role of dividing by a in modular arithmetic. Since 3 × 4 = 12 ≡ 1 (mod 11), the inverse of 3 mod 11 is 4.
什么时候没有逆元?When does no inverse exist?
只有 a 和 m 互质(最大公约数为 1)时才有逆元。例如 2 模 4 没有逆元,因为 gcd(2, 4) = 2。m 是质数时,除 0 以外每个数都有逆元。Only when a and m are coprime (gcd 1). 2 has no inverse mod 4 because gcd(2, 4) = 2. When m is prime, every number except 0 has an inverse.
支持多大的数?How big can the numbers be?
用 BigInt 精确计算,几千位的整数也可以,常用于 RSA 等密码学练习。负数会先换成 0 到 m − 1 之间的等价数。Everything uses exact BigInt arithmetic, so integers with thousands of digits work, as in RSA exercises. A negative a is first reduced to its equivalent between 0 and m − 1.
能举个计算实例吗?Can you show a worked example?
例如在「模逆元计算器(扩展欧几里得,支持大整数)」中填 整数 a = 3,模 m(≥ 2) = 11,结果区显示:a mod m:3;gcd(a, m):1;逆元 x:4;验证:3 × 4 mod 11 = 1For example, entering Integer a = 3, Modulus m (2 or more) = 11 in the Modular Inverse Calculator (Extended Euclid, Big Integers) gives: a mod m: 3; gcd(a, m): 1; Inverse x: 4; Check: 3 × 4 mod 11 = 1
有哪些选项可以调整?What options can I adjust?
「模逆元计算器(扩展欧几里得,支持大整数)」的设置:「整数 a」默认 3;「模 m(≥ 2)」默认 11。每次生成结果都按当前设置处理。Settings in the Modular Inverse Calculator (Extended Euclid, Big Integers) — "Integer a" default 3; "Modulus m (2 or more)" default 11. The result always uses the current settings.
计算精度如何?How precise are the results?
「模逆元计算器(扩展欧几里得,支持大整数)」使用 JavaScript 双精度浮点数(约 15–16 位有效数字),部分功能使用 BigInt 处理大整数。The Modular Inverse Calculator (Extended Euclid, Big Integers) uses double-precision floating point (about 15–16 significant digits); some features use BigInt for large integers.
「模逆元计算器(扩展欧几里得,支持大整数)」免费吗?需要注册吗?Is the Modular Inverse Calculator (Extended Euclid, Big Integers) free? Do I need an account?
「模逆元计算器(扩展欧几里得,支持大整数)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Modular Inverse Calculator (Extended Euclid, Big Integers) is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.