# Sheet8 - McMaster University Department of Computing and...

This preview shows pages 1–2. Sign up to view the full content.

Department of Computing and Software Dr. W. Kahl COMP SCI 1FC3 Exercise Sheet 8 COMP SCI 1FC3 — Mathematics for Computing 13 March 2009 Exercise 8.1 — Mathematical Induction Proofs (Textbook pp. 279–280) Prove the following by mathematical induction: (a) 2 1 + 2 3 + 2 5 + ⋅ ⋅ ⋅ + (2 n + 2 1) = ( n + 1)(2 n + 1)(2 n + 3) / 3 whenever n is a nonnegative integer (b) 1 ⋅ 1! + 2 ⋅ 2! + ⋅ ⋅ ⋅ + n n ! = ( n + 1)! - 1 whenever n is a nonnegative integer (c) n k =1 k k 2 = ( n - n +1 1)2 + 2 whenever n is a positive integer (d) n ! < n n whenever n is an integer greater than 1 Exercise 8.2 — Haskell Evaluation Consider the following Haskell source Evaluation.hs (available on the course page): f 0 = 1 f n = n * f ( n - 1 ) g a 0 = a g a b = if a < b then g b a else g ( a - b ) b h 1 = 1 h n = if even n then h ( n ‘div‘ 2 ) else h ( 3 * n + 1 ) Evaluate manually the following Haskell expressions: (a) f 2 (b) f 4 (c) g 12 6 (d) g 14 10 (e) h 1 (f)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/26/2011 for the course CS 1fc3 taught by Professor Kahl during the Spring '11 term at McMaster University.

### Page1 / 2

Sheet8 - McMaster University Department of Computing and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online