Homework 7, Mon 11-21-11

advertisement
Homework 7, Mon 11-21-11
CS 2050, Intro Discrete Math for Computer Science
Due Wed 11-30-11, Note: This homework has 1 page and 4 problems.
Problem 1: 25 Points
k
a. Compute 52 mod7, for k = 1, k = 2, k = 3, k = 4, k = 5, k = 6, k = 7, k = 8, k = 9 and
k = 10. (That is, compute 52 mod7, 54 mod7, 58 mod7, 516 mod7, 532 mod7, etc.)
b. Compute 5301 mod7, 5602 mod7 and 5903 mod7 (use part (a) for fast exponantiation.)
Problem 2: 25 Points
a. Prove that 10x3 − 100x2 + 1000x − 12 = O(x3 ).
b. Place in the correct
order of growth the following functions (no explanation is needed):
p
√
1
n
log10 n, n, 2 , log2 n, 2n log2 n , log22 n, n2 , n 3 , n log22 n, n2 log2 n, 3n .
Problem 3: 25 Points
An investment of X dollars on January 1st 2012 will be increasing by 50% each year and an
additional 1, 000 dollars will be added to the account as bonus at the end of each year.
a. If one invests 10, 000 on January 1st 2012, what will the value of the account be on
December 31st 2012? What will the value of the account be on December 31st 2013? What
will the value of the account be on December 31st 2014?
b. Prove that, if one invests 10, 000 on January 1st 2012, then the value of the acount on
December 31st of year (2012+n) will be 1.5n × 18, 000 − 2, 000, for all integers n ≥ 0.
Problem 4: 25 Points
a. For every integer n ≥ 1, prove that there are 2n binary strings of length exactly n.
b. For every integer n ≥ 2, prove that there are 2 + 22 + . . . + 2n−1 = 2n − 2 binary strings
of length at most (n − 1). (That is, strings of length 1,2,3, . . . ,n − 1.)
c. Let bn bn−1 . . . b1 be a binary string of length n. Define the function
P f from such binary
strings to positive integers as follows: f (bn bn−1 . . . b1 ) = (2n − 2) + ( ni=1 bi 2i−1 ) + 1.
What is f (0)? What is f (1)? What is f (00)? What is f (01)? What is f (10)? What is
f (11)? What is f (000)? What is f (001)? What is f (010)? What is f (011)? What is
f (100)? What is f (101)? What is f (110)? What is f (111)?
d. Determine the binary string bn bn−1 . . . b1 , such that f (bn bn−1 . . . b1 ) = 100.
e. Determine the binary string bn bn−1 . . . b1 , such that f (bn bn−1 . . . b1 ) = 1001.
f. Given an arbitrary positive integer N , argue that there is a unique binary string bn bn−1 . . . b1 ,
such that f (bn bn−1 . . . b1 ) = N .
1
Download