Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. def expo_mod(nbr,pow,mod):
  2.     if pow == 0:
  3.         return 1
  4.     res = expo_mod(nbr,pow >> 1,mod)
  5.     if pow % 2:
  6.         return (res * res) % mod
  7.     else:
  8.         return (nbr * res) % mod
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement