Last active
June 7, 2017 10:34
-
-
Save vitalymak/36c0def10ffd96b47c81409a0d3e5024 to your computer and use it in GitHub Desktop.
Power by module
This file contains 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 powMod(num, pow, mod) { | |
let res = 1; | |
for (let i = 0; i < pow; ++i) { | |
res = res * num % mod; | |
} | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment