Question: SEE MY FAILED TEST PLEASE USE THE ALGORITHM AND PSEUDOCODE EXAMPLE PROVIDED. PLEASE CODE IN PYTHON USING JUPYTER!!! THANKS Program a function mod_exp (b,n,m) that




SEE MY FAILED TEST
PLEASE USE THE ALGORITHM AND PSEUDOCODE EXAMPLE PROVIDED.
PLEASE CODE IN PYTHON USING JUPYTER!!! THANKS
Program a function mod_exp (b,n,m) that computes bnmodm using the algorithm discussed in lecture. No credit will be given to functions that employ any other implementation. For example, if the function implementation simply consists of no credit will be given. The function should satisfy the following: 1. INPUT: - b-positive integer representing the base - n-positive integer representing the exponent - m - positive integer representing the modulo 2. OUTPUT: - the computation of bnmodm if b,n,m are positive integers, 0 otherwise. EXAMPLE: \[ \gg \text { mod_exp }(3,644,645) \] 36 Logs: mod_exp( - test \#1 Testing mod_exp (23,976,352) Result: 1 Expected: 0 Test failed. Corollavy 4.1.4 ALGORITHM | Modular Exponentiation a.6modm GOAL: bnmodm when b,m, and n are large. =(amodm)(bmodm)modm 1. Find the binary expansion of n,n=ak12k1++a12+a0. 2. Use Corollary to THM 4.1.4 to compute bnmodm=bak12k1bak22k2ba12ba0modm=[(bak12k1modm)(bak22k2ba12ba0modm)]modm=[(bak12k1modm)((bak22k2modm)bak32k3ba12ba0modm)]modm PSEUDOCODE | Modular Exponentiation INPUT: b-integer, m-integer, n=(ak1,ak2,,a1,a0)2 OUTPUT: bnmodm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
