Created
March 8, 2015 21:27
-
-
Save rtoal/b52e8680e8fe508973f4 to your computer and use it in GitHub Desktop.
Modular double exponentiation
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
function powerpowermod(a, b, c, p) | |
if !isprime(p) | |
error("Go away. I not gonna even try this.") | |
end | |
return powermod(a, powermod(b, c, p-1), p) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment