Chapter 5: Q8E (page 370)
Give a recursive algorithm for finding the sum of the first n positive integers.
Short Answer
The recursive algorithm is,
Chapter 5: Q8E (page 370)
Give a recursive algorithm for finding the sum of the first n positive integers.
The recursive algorithm is,
All the tools & learning materials you need for study success - in one app.
Get started for freeLet P (n) be the statement that a postage of n cents can be formed using just 3-cent stamps and 5-cent stamps. The parts of this exercise outline a strong induction proof that P (n) is true for n ≥ 8.
a) Show that the statements P (8), P (9), and P (10) are true, completing the basis step of the proof.
b) What is the inductive hypothesis of the proof?
c) What do you need to prove in the inductive step?
d) Complete the inductive step for k ≥ 10.
e) Explain why these steps show that this statement is true whenever n ≥ 8.
Trace Algorithm 3 when it finds gcd (8,13). That is, show all the steps used by Algorithm 3 to find (8,13).
Give a recursive algorithm for finding whenever n! and m are positive integers.
Prove that divisible by 8 whenever n is an odd positive integer.
Use strong induction to show that every positive integer n can be written as a sum of distinct powers of two, that is, as a sum of subset of the integers and so on. [Hint: For the inductive step, separately consider the case where is even and where it is odd. When it is even, note that is an integer.]
What do you think about this solution?
We value your feedback to improve our textbook solutions.