c++python-3.xbuilt-ininteger-arithmeticmodular-arithmetic

Modular Inverse Built-In, C++


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 :

b = pow(a, -1, m)

pow is built-in in . Is there something like this in ?


Solution

  • No there is no built-in function in C++ (to answer your question :) ).