• :00Days
  • :00Hours
  • :00Mins
  • 00Seconds
A new era for learning is coming soonSign up for free
Log In Start studying!

Select your language

Suggested languages for you:
Answers without the blur. Sign up and see all textbooks for free! Illustration

Q5E

Expert-verified
Discrete Mathematics and its Applications
Found in: Page 370
Discrete Mathematics and its Applications

Discrete Mathematics and its Applications

Book edition 7th
Author(s) Kenneth H. Rosen
Pages 808 pages
ISBN 9780073383095

Answers without the blur.

Just sign up for free and you're in.

Illustration

Short Answer

Trace Algorithm 4 when it is given m = 5 , n = 11 , and b = 3 as input. That is, show all the steps Algorithm 4 uses to find 3 mod 5 .

The value is 311 mod 5 =2 .

See the step by step solution

Step by Step Solution

Step 1: Recursive Definition

From the recursive definition,

mpower(b,n,m)={1     if n=0mpower(b,n/2,m)2modm     if n even mpower(b,n/2,m)2modmbmodmmodm     otherwise

Step 2: Determine the recursive

Evaluate the recursive definition at n = 11 , m = 5 and b = 3.

311mod5=mpower(3,11,5)

=mpower(3,11/2,5)2mod53mod5mod5=mpower(3,5,5)2mod53mod5

Determine mpower (3,5,5).

mpower(3,5,5)=mpower(3,5/2,5)2mod53mod5mod5=mpower(3,2,5)2mod53mod5

Determine mpower (3,2,5).

mpower(3,2,5)=mpower(3,2/2,5)mod5=mpower(3,1,5)mod5=mpower(3,1/2,5)2mod53mod5mod5=mpower(3,0,5)2mod53mod5

Simplify further.

mpower(3,2,5)=12mod53mod5=[13]mod5=3mod5=3

Evaluate the found expression for mpower (3,5,5).

mpower(3,5,5)=mpower(3,5/2,5)2mod53mod5mod5=mpower(3,2,5)2mod53mod5=32mod53mod5=[9mod53]mod5

Simplify further.

mpower(3,5,5)=[43]mod5=12mod5=2

Evaluate the found expression for mpower (3,11,5).

311mod5=mpower(3,11,5)=mpower(3,11/2,5)2mod53mod5mod5=mpower(3,5,5)2mod53mod5=22mod53mod5

Simplify further.

311mod5=[4mod53]mod5=[43]mod5=12mod5=2

Therefore, the value is 311mod 5=2 .

Recommended explanations on Math Textbooks

94% of StudySmarter users get better grades.

Sign up for free
94% of StudySmarter users get better grades.