Created
October 2, 2019 14:54
-
-
Save Descalon/3c1ca7a7cafc2f569f457cd65fb99c52 to your computer and use it in GitHub Desktop.
lab5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ModularExponentiation where | |
slowExM :: Integer -> Integer -> Integer -> Integer | |
slowExM x e m = (x ^ e) `mod` m | |
exM :: Integer -> Integer -> Integer -> Integer | |
exM x e m = | |
let exM' c e' = if e' < e then exM' c' (e'+1) else c' | |
where c' = (x * c) `mod` m | |
in exM' 1 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment