(41) Exponentiation & Residue Reduction
|
05-11-2020, 02:55 PM
(This post was last modified: 05-11-2020 07:30 PM by Albert Chan.)
Post: #3
|
|||
|
|||
RE: (41) Exponentiation & Residue Reduction
(05-08-2020 01:58 PM)Werner Wrote: Stack-only, without synthetics, 50 bytes Amazing ! I touch up a bit so that it can copy/paste directly into Free42 (52 bytes) Code: 01▸LBL "Z↑YMOD" Example 123^456 mod 789: 123 [Enter] 456 [Enter] 789 [XEQ] "Z↑YMOD" → 699 This version does binary ladder expoentiation from right to left, like this: Code: (define (pow-mod b x m r) scheme> (trace pow-mod) (pow-mod) scheme> (pow-mod 123 456 789 1) |(pow-mod 123 456 789 1) |(pow-mod 138 228 789 1) |(pow-mod 108 114 789 1) |(pow-mod 618 57 789 1) |(pow-mod 48 28 789 618) |(pow-mod 726 14 789 618) |(pow-mod 24 7 789 618) |(pow-mod 576 3 789 630) |(pow-mod 396 1 789 729) |(pow-mod 594 0 789 699) |699 699 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(41) Exponentiation & Residue Reduction - SlideRule - 04-06-2020, 01:31 PM
RE: (41) Exponentiation & Residue Reduction - Werner - 05-08-2020, 01:58 PM
RE: (41) Exponentiation & Residue Reduction - Albert Chan - 05-11-2020 02:55 PM
RE: (41) Exponentiation & Residue Reduction - Thomas Klemm - 04-26-2022, 03:17 AM
Errata: (41) Exponentiation & Residue Reduction - Thomas Klemm - 04-26-2022, 10:59 AM
Errata: (41) Exponentiation & Residue Reduction - Thomas Klemm - 04-26-2022, 04:05 PM
|
User(s) browsing this thread: 1 Guest(s)