Guest User

Untitled

a guest
Jan 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. modPow x y n
  2.  | y == 0          = 1
  3.  | y `mod` 2 == 0  = let a = (modPow x (y `div` 2) n) in (a*a) `mod` n
  4.  | otherwise       = ((x `mod` n) * (modPow x (y-1) n)) `mod` n
Add Comment
Please, Sign In to add comment