Advertisement
peltorator

random mod inverse

Mar 5th, 2019
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.09 KB | None | 0 0
  1. ll inv(ll a, ll m)
  2. {
  3.     if (a == 1)
  4.         return 1;
  5.     return ((1 - inv(m % a, a) * m) / a) + m;
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement