There is a very nice way to find a modular inverse (that is, such b that ab ≡ 1 (mod m) for given a and m) in python-3.8:
b = pow(a, -1, m)
pow is built-in in python-3.8. Is there something like this in c++?
No there is no built-in function in C++ (to answer your question :) ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With