This make-up test is optional, although I would recommend that you take it, even those of you who did well on the first test. Taking this test can only improve your score -- that is, I will not average the two tests. Nor will I take the better of the two: instead, I will increase the score of your first test as a function of your score on the second.
All questions on this test ask you to write a proof. All proofs are very short; I have given what I consider a reasonable length for each proof in parentheses, but do not worry if your proof is shorter or longer!
This test is open-book, open-notes. Turn in the test by 5pm today (Friday 10). There are five questions, all worth the same number of points.
Problem 1.
(2-3 lines)
Prove by contradiction: if the product xy is strictly larger
than n2, then at least one of x and y
must be strictly larger than n.
Problem 2.
(3-5 lines)
Prove directly: if n is odd, then n2-1 is
divisible by 8. (Hint: yes, I do mean by 8, not just by 4.)
Problem 3.
(5-7 lines)
Prove by induction that the sum of three consecutive cubes is divisible by 9;
that is, for any positive n, the sum n3+(n+1)3+(n+2)3 is divisible by 9.
Problem 4.
(4-6 lines)
The Fibonacci numbers are defined recursively as follows:
F1=1 F2=1 Fn=Fn-1+Fn-2Prove by induction that the sum of the first n Fibonacci numbers equals Fn+2-1.
Problem 5.
(4-6 lines for the invariant, 4-6 lines to use it to prove correctness)
Consider the following subroutine, called with parameter n
answer = 0 product = 1 while product < n do product = 2*product answer++ return answerProve that this routine returns the (floor of the) logarithm base 2 of n by verifying (by induction, of course) and using the loop invariant product = 2answer. (Hint: note that a normal use of the loop invariant establishes that answer cannot exceed that value, but to show that they are equal, you need to use the invariant twice, once for an upper bound and once for a lower bound.)