Modular inverse and power
Find an integer modular inverse when it exists and compute an exact modular power.
The example value has been entered. Check it immediately or change the value.
Input is processed in the browser. Refreshing returns a sample value.
Instructions and example
ax≡1 (mod m); aᵉ mod m
The inverse of 17 modulo 3120 is 2753, and 17^13 mod 3120 is 17.
Integers allow up to 30 digits, modulus greater than 1 and exponent 0–1000000.
Frequently asked questions
When does a modular inverse not exist?
If the value and modulus are not coprime, no inverse exists. Modular power is still computed.
Are large modular integers rounded?
Integer strings are processed with BigInt for exact arithmetic within the limits. Decimal inputs are rejected.
Calculation criteria and reference materials
- Python: Modular Power and Inverse
ax≡1 (mod m); aᵉ mod m
Verification of calculation criteria: · Calculation·verification principles · Report errors