ModularInverse

ModularInverse[k,n]

gives the modular inverse of k modulo n.

Details

  • ModularInverse[k,n] gives the number r such that Mod[r k,n]1.
  • If k and n are not coprime, so no modular inverse exists, ModularInverse[k,n] remains unevaluated.

Examples

open allclose all

Basic Examples  (1)

Find the modular inverse of 3 modulo 5:

In[1]:=
Click for copyable input
Out[1]=

Check the result:

In[2]:=
Click for copyable input
Out[2]=

Scope  (2)

Properties & Relations  (5)

Possible Issues  (1)

See Also

PowerMod  Mod  Power  PowerModList  ExtendedGCD  MultiplicativeOrder  EulerPhi  PrimitiveRoot

Introduced in 2017
(11.1)