Maths & numbers

Modular multiplicative inverse

Find an exact integer inverse and verify the modular product.

Modular multiplicative inverse
Esc to restore

Your inputs

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded, and nothing is saved unless you choose “Save result”.

A clear answer. Here’s how.

Uses the extended Euclidean algorithm on a modulo positive m. An inverse exists only when gcd(a,m)=1. Returns the representative in [0,m) and verifies (a×inverse) mod m=1. Negative a is supported. Inputs are integer text of at most 80 digits, so large values do not pass through floating-point numbers.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

Integer a
17
Modulus m, greater than 1
3120

Example result

Modular inverse
2753
Verification (a × inverse) mod m
1