File size: 454 Bytes
bff4ec7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Modular Multiplicative Inverse
## Description
Given coprime positive integers $a$ and $m$, compute the canonical multiplicative inverse of $a$ modulo $m$.
## Input
The function receives $a$ and modulus $m$.
## Output
Return the unique $x$ in $[0,m)$ such that $ax \equiv 1 \pmod m$.
## Constraints
- $1 < m$.
- $0 < a < m$.
- $\gcd(a,m)=1$.
## Source
Classical extended-Euclidean-algorithm problem reconstructed from the verified C artifact.
|