Advertisement
Vaskor096

Modular multiplication inverse

Nov 13th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.18 KB | None | 0 0
  1. ll bigmod(ll a,ll b,ll m)
  2. {
  3.  
  4. if(b==0)
  5. return 1;
  6. ll x=bigmod(a,b/2,m) ;
  7. x=(x*x)%m;
  8. if(b%2==1)
  9. {
  10. x=(x*a)%m;
  11.  
  12. }
  13. return x;
  14.  
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement