A modular inverse can be computed in Mathematica using PowerMod[b, -1, m]. Every nonzero integer b ...
mathworld.wolfram.com