modinv(x, N)

Computes multiplicative inverse of x modulo N

You are now following this Submission

Using variable precision integers, computes y such that
mod(x*y, N) == 1 is TRUE.

Cite As

Steven Gregory (2026). modinv(x, N) (https://www.mathworks.com/matlabcentral/fileexchange/23802-modinv-x-n), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: nextperm, logmod

Inspired: logmod, nextperm, egcd.m

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

Rewrote the code to exploit (the new) VPIs matrix-related functions.

1.0.0.0