Advertisement
Guest User

exprem

a guest
May 14th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. Define exprem(b,p,m)=
  2. Func
  3. :Local res
  4. :res:=1
  5. :While p>0
  6. : If (p and 1)=1:res:=mod(res*b,m)
  7. : b:=mod(b*b,m)
  8. : p:=intDiv(p,2)
  9. :EndWhile
  10. :Return res
  11. :EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement