   Chapter 11.5, Problem 26ES ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193
Textbook Problem
1 views

# It might seem that n − 1 multiplications are needed to compute x n , since x n = x ⋅ x ⋅ ⋯ x ︸ n − 1   multiplications But observe that, for instance, since 6 = 4 + 2 ,   x 6 = x 4 x 2 = ( x 2 ) 2 x 2 . Thus x 6 can be computed using three multiplications: one to compute x 2 , one to compute ( x 2 ) 2 ,

To determine

(a)

To findout the contain nth power of x and resulting squares by using multiplication algorithms.

Explanation

The Input of the algorithm is real number x and a positive integer n.

Input :n/positive integer/,x/real number/

First using the algorithm that determines the binary representation of n.

Algorithm body:

q:=n i:=0while(i=0 or q0)r[i]=q mod2q:=q div2i:i+1end whileNext computing x2,x22,x23....x2k1,x2k

by repetitively squaring x and the resulting squares

To determine

(b)

To find out the contain nth power of x and resulting squares by using multiplication algorithms.

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started 