Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.12 KB | None | 0 0
  1. def fast_pow(x, p):
  2. res = 1
  3. while p > 0:
  4. if p % 2 == 1:
  5. res = res * x
  6. x = x * x
  7. p //= 2
  8. return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement