Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # compute B^E mod M
- def prodmodul(B, E, M):
- buf=1
- while E > 0:
- buf=(buf * (( B**(E%10) ) % M) ) % M
- B=(B**10) % M
- E//=10L
- return buf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement