   Chapter 11.5, Problem 10ES ### 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

# Exercises 8—11 refer to the following algorithm segment. For each positive integer n, let a n be the number of iterations of the while loop. while   ( n > 0 ) n : = n   d i v   2 end while 10. Find a explict formula for a n .

To determine

Find an explicit formula for an.

Explanation

Given information:

For each positive integer n, let an be the number of iterations of the while loop. while ( n > 0)

n := n div 2

end whileCalculation:

We know that (from pervious exercise)

an=an/2+1 for all integers n2a1=1

Let us determine the first terms of the given recurrence relation:

a1=1=1+log21

a2=a2/2+1=a1+1=1+1=2=1+log22

a3=a3/2+1=a1+1=1+1=2=1+log23

a4=a4/2+1=a2+1=2+1=3=1+log24

a5=a5/2+1=a2+1=2+1=3=1+log25

a6=a6/2+1=a3+1=2+1=3=1+log26

a7=a7/2+1=a3+1=2+1=3=1+log27

a8=a8/2+1=a4+1=3+1=4=1+log28

a9=a9/2+1=a4+1=3+1=4=1+log29

a15=a15/2+1=a7+1=3+1=4=1+log215

a16=a16/2+1=a8+1=4+1=5=1+log216

We then note that an=1+log2n appear to be true for these values of n, which we will proof is true.

Given:

an=an/2+1 for all integers n2a1=1

To proof: an=1+log2n for all integers n1

PROOF BY STRONG INDUCTION:

Let P(n) be "an=1+log2n"

Basis step: n = 1

a1=1=1+0=1+log21

Thus P (1) is true.

INDUCTIVE STEP:

let P(1),P(2),...,P(k) be true, thus ai=1+log2i for i=1,2,...,k

We need to prove that P ( k + 1) is true.

FIRST CASE: k odd

Since k is odd, k + 1 is even and thus ( k + 1) / 2 is an integer

### 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 