Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Prove by induction that for every integer n 2 1: 1(1!) + 2(2!) + 3(3!) + ... + n(n!) = (n+ 1)! -1 (here n!

image text in transcribed
Prove by induction that for every integer n 2 1: 1(1!) + 2(2!) + 3(3!) + ... + n(n!) = (n+ 1)! -1 (here n! = nx (n- 1) x .. x2x1for any integer n21) Consider the following recursive program that follows (roughly) Euler's Method for computing the GCD of two numbers: Int GCD(Int n, int k) |/ Function to compute GCD(n,K) ; We want n> =k Initially { f (k -= 0) return n: // Base Case F (nzk) { If (k z n-k) return GCD( k , n-k) ; I/ Before we subtract k from n we want the larger of this result and k to go f else return GCD(n -k, k ) II ff n-k is larger we put it first else return GCD(n , k-n ) : I/ the good case a) Write down the sequence of function calls produced by this algorithm when n: -90 and k = 48. b) Give a big O approximation in terms of n (assume that n> k initially) for the number of functions calls that will result from Initially calling GOD(n,k) . Hint: Look backwards at the sequence of numbers produced by this algorithm; In reverse we see a familar pattern

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

An Introduction to Analysis

Authors: William R. Wade

4th edition

132296381, 978-0132296380

More Books

Students also viewed these Mathematics questions