Chapter 5: Q9E (page 370)
Give a recursive algorithm for finding the sum of the first n odd positive integers.
Short Answer
The recursive algorithm is,
Chapter 5: Q9E (page 370)
Give a recursive algorithm for finding the sum of the first n odd positive integers.
The recursive algorithm is,
All the tools & learning materials you need for study success - in one app.
Get started for freeDevise a recursive algorithm for finding whenever n, x, and m are positive integers based on the fact that .
(a) Determine which amounts of postage can be formed using just 4-cent and 11-cent stamps.
(b) Prove your answer to (a) using the principle of mathematical induction. Be sure to state explicitly your inductive hypothesis in the inductive step.
(c) Prove your answer to (a) using strong induction. How does the inductive hypothesis in this proof differ from that in the inductive hypothesis for a proof using mathematical induction?
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 .
Trace Algorithm 3 when it finds gcd (12,17) . That is, show all the steps used by Algorithm 3 to find gcd (12,17).
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.