package main import ( "fmt" "math/big" ) func main() { n := big.NewInt(7) mod := big.NewInt(11) inv := new(big.Int).ModInverse(n, mod) fmt.Println(inv) }
package main import ( "fmt" "math/big" ) func main() { n := big.NewInt(10) mod := big.NewInt(3) inv := new(big.Int).ModInverse(n, mod) fmt.Println(inv) }In this example, we are finding the modular inverse of the number 10 with respect to modulo 3. However, since the inverse does not exist, the method returns nil. The package library for the big.Int.ModInverse method is math/big.