Question
java or c++ Task two. Square and multiply - Fast Exponential You are to implement fast.cpp or fast.java in this task, to implement the fast
java or c++ Task two. Square and multiply - Fast Exponential
You are to implement fast.cpp or fast.java in this task, to implement the fast exponential using the square and multiply technique as described in the lecture. That is, you need to compute:
a^b (mod p)
Your program needs to input 3 parameters namely a, b and p. Then, you will need to do the following:
1. convert b into binary
2. convert that binary to the S and X notation
3. remove the first SX
4. compute according to the sequence
The program must output each process one by one to the screen - not directly outputting the final result only. The number of steps must match the sequence of SX as identified above.
Your implementation must be able to produce result (output) where the value of b is greater than 256 or a number that is at least 8 bit long.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started