RosettaCodeData/Task/Modular-exponentiation/Clojure/modular-exponentiation-2.clj

6 lines
283 B
Clojure

(defn modpow
" b^e mod m (using Java which solves some cases the pure clojure method has to be modified to tackle--i.e. with large b & e and
calculation simplications when gcd(b, m) == 1 and gcd(e, m) == 1) "
[b e m]
(.modPow (biginteger b) (biginteger e) (biginteger m)))