Chapter 5: Q7E (page 377)
use a loop invariant to prove that the following program segment for computing the nth power, where is a positive integer, of a real number x is correct.
Short Answer
yes, it is correct.
Chapter 5: Q7E (page 377)
use a loop invariant to prove that the following program segment for computing the nth power, where is a positive integer, of a real number x is correct.
yes, it is correct.
All the tools & learning materials you need for study success - in one app.
Get started for freeProve that the recursive algorithm for finding the sum of the first n positive integers you found in Exercise 8 is correct.
Prove that 2 divides whenever n is a positive integer.
Use the well-ordering principle to show that if x and y are real numbers with x<y, then there is a rational number r with x<r<y. [Hint: Use the Archimedean property, given in Appendix 1, to find a positive integer A with . Then show that there is a rational number with denominator A between x and y by looking at the numbers , where is a positive integer.]
Prove that Algorithm 3 for computing gcd (a,b) when a and b are positive integers with a < b is correct.
Let 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.
What do you think about this solution?
We value your feedback to improve our textbook solutions.