March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 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))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue