Search code examples
paripari-gp

How to calculate the Modular multiplicative inverse in pari?


The modular multiplicative inverse is an integer ‘x’ such that.

a x ≡ 1 (mod m).

So, is there any way to calculate the Modular multiplicative inverse in pari\gp calculator ?

I am really sorry if this question is trivial or duplicated.


Solution

  • Just Mod(1/a, m), where a and m are your relatively prime numbers. See example for a = 3 and m = 1133 below.

    lift(Mod(1/3, 1133))
    > 378