

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Exam 2 CMSC 203 Fall 2004
1. Circle T if the corresponding statement is True or F if it is False. T F Every integer greater than 1 is divisible by a prime. T F For all integers a, b, and c , if b divides a and c divides a , then GCD( b,c ) = 1. T F Every iterative algorithm can be expressed as a recursive algorithm. T F 1 + 2 + 3 + ... + 1,000,000 = 500,000(1,000,000). T F For integers a and b , if a and b are relatively prime, then GCD( a,b ) = 1. T F The Fibonacci Sequence is 1, 1, 2, 3, 5, 8, 13, 21, ....
T F (3 1000 ā 3999 ) + (3^999 ā 3 998 ) + ... + (3^3 ā 32 ) + (3 2 ā 3) + ( 3 ā 1) is a Telescoping Series. T F For any non-zero integers a and b , ab = GCD( a,b )LCM( a,b ).
(b) Given the sequences, { an } and { bn }, defined for n > 0, by: an = 2 n^ and b (^) n = n^2 , find c 0 , c 1 , c 2 , and c 3 when c (^) n = an + bn.
3. List out an algorithm to apply the Quotient-Remainder Theorem to integers n and d. 4. The following algorithms evaluate the polynomial a (^) nx n^ + an ā 1 x n^ ā^1 +...+ a 1 x + a 0 at x = c. Step
through each to evaluate 2 x^3 + x^2 + 2 x + 1 at x = 3.
procedure poly1 ( c , a 0 , a 1 , ..., an : real numbers)
power := 1 y := a 0
for i = 1 to n power := power * c y := y + a (^) i * power
next i output y
procedure poly2 ( c , a 0 , a 1 , ..., an : real numbers)
y := an
for i = 1 to n y := y * c + an ā i
next i output y
i 0 1 2 3
poly1 power = power = power = power = ai = ai = ai = ai = y = y = y = y = poly2 a (^) n ā i = an ā i = an ā i = an ā i =
y = y = y = y =
Docsity.com
5. Use the Euclidean Algorithm to find GCD(1452, 630). 6. Given the sequence { ai } where an +1 = (2 an + 1) mod 4, calculate the next 5 terms
when a 0 = 1. What do you observe about the sequence?
7. Calculate the following without using a calculator:
(a) (b)
8. Prove 2 of the 3 Theorems below using Weak or Strong Mathematical Induction.
Theorem 1: For all integers n > 0,
Theorem 2: If an = an -1 + an -2 + an -3 + an -4 and a 0 = a 1 = a 2 = a 3 = 4, then an < 4 n^ for all n > 3.
Theorem 3: Every set with n elements has 2 n^ subsets.
i
i = 0
100
i = 0
100
9 i i = 0
n
9 n^ +^1 ā 1 8