Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def expo_mod(nbr,pow,mod):
- if pow == 0:
- return 1
- res = expo_mod(nbr,pow >> 1,mod)
- if pow % 2:
- return (res * res) % mod
- else:
- return (nbr * res) % mod
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement