invmod

invmod(x,m)

Take the inverse of x modulo m: y such that $xy = 1 \pmod m$.

Examples

julia> invmod(3, 7)
5

julia> invmod(6, 11)
2

The invmod function calculates the modular multiplicative inverse of x modulo m. It returns y such that x * y ≡ 1 (mod m). Here are a couple of examples:

  1. Calculate inverse modulo 7:

    julia> invmod(3, 7)
    5

    This example calculates the modular multiplicative inverse of 3 modulo 7, which is 5.

  2. Calculate inverse modulo 11:
    julia> invmod(6, 11)
    2

    Here, the inverse of 6 modulo 11 is 2.

Note that the invmod function throws an error if the modular inverse does not exist.

See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: