If is a power of , then the minimum number of multiplications needed to compute is
View worked solution
Answer: A
We can compute efficiently using the repeated squaring method (also known as exponentiation by squaring).
Let for some non-negative integer . We can compute the powers of sequentially as follows:
- (1 multiplication)
- (2 multiplications)
- (3 multiplications)
- ( multiplications)
Since , taking the logarithm on both sides gives:
Thus, the minimum number of multiplications required to compute when is a power of is .
Correct Option: A
Free practice · Your answers on this page are not saved.
