Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
(defn powerMod "modular exponentiation" [b e m]
|
||||
(defn m* [p q] (mod (* p q) m))
|
||||
(loop [b b, e e, x 1]
|
||||
(if (zero? e) x
|
||||
(if (even? e) (recur (m* b b) (/ e 2) x)
|
||||
(recur (m* b b) (quot e 2) (m* b x))))))
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(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)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue