ModularInverse
ModularInverse[k,n]
gives the modular inverse of k modulo n.
Details
- ModularInverse is also known as modular multiplicative inverse.
- Integer mathematical function, suitable for both symbolic and numerical manipulation.
- Typically used in modular arithmetic and cryptography.
- ModularInverse[k,n] gives the number r such that the remainder of the division of r k by n is equal to 1.
- If k and n are not coprime, no modular inverse exists and ModularInverse[k,n] remains unevaluated.
Examples
open allclose allBasic Examples (2)
Scope (2)
Applications (4)
Properties & Relations (6)
ModularInverse is a periodic function:
ExtendedGCD returns modular inverses:
Compute using PowerMod:
The results have the same sign as the modulus:
If and are coprime, then is invertible modulo :
Computing ModularInverse twice yields the original argument:
Possible Issues (1)
For nonzero integers k and n, ModularInverse[k,n] exists if and only if k and n are coprime:
However, 10 and 22 are not coprime:
Text
Wolfram Research (2017), ModularInverse, Wolfram Language function, https://reference.wolfram.com/language/ref/ModularInverse.html.
CMS
Wolfram Language. 2017. "ModularInverse." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ModularInverse.html.
APA
Wolfram Language. (2017). ModularInverse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ModularInverse.html