cielseven's picture
add benchmark corpora, groundtruth, symexec scripts and coverage docs
bff4ec7
|
Raw History Blame Contribute Delete
454 Bytes

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.