peltorator

random mod inverse

Mar 5th, 2019
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data