Timeline for MatrixPower with Modulus
Current License: CC BY-SA 3.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 7, 2016 at 1:03 | history | edited | J. M.'s missing motivation♦ | CC BY-SA 3.0 |
added 5 characters in body
|
Aug 6, 2016 at 15:21 | comment | added | J. M.'s missing motivation♦ |
This is, of course, the "Russian peasant" algorithm for exponentiation. Here is a compact implementation: Fold[Mod[If[#2 == 1, a.#, #].#, m] &, a, Rest[IntegerDigits[n, 2]]] .
|
|
Aug 6, 2016 at 15:17 | history | answered | KennyColnago | CC BY-SA 3.0 |