Small Python utilities to compute GCD, Bezout coefficients, and modular inverses using the Extended Euclidean Algorithm.
large_modular_inverse.py— compute modular inverse viaextended_euclid(a, b)andmod_inv(a, n).extended_euclid_table.py— show step-by-step algorithm table withextended_euclid_table(a, b)andprint_table(rows).
Finds integers x, y such that
a*x + b*y = gcd(a, b).
If gcd(a, n) = 1, then x is the modular inverse of a mod n.
Run examples:
python large_modular_inverse.py
python extended_euclid_table.py