4.6: Exercises
1. Suppose you are given a list of \(n\) integers, each of size at most \(100n\). How many operations would it take you to do the following tasks (in answering these questions, we are interested primarily in whether it will take \(\log n, \sqrt{n}, n, n^2, n^3, 2^n, … \) steps. In other words, ignore multiplicative constants.):
a. Determine if the number \(2n+7\) is in the list.
b. Determine if there are two numbers in the list whose sum is \(2n+7\).
c. Determine if there are two numbers in the list whose product is \(2n+7\) (This one is more subtle than it might appear! It may be to your advantage to sort the integers in the list).
d. Determine if there is a number \(i\) for which all the numbers in the list are between \(i\) and \(i+2n+7\).
e. Determine the longest sequence of consecutive integers belonging to the list.
f. Determine the number of primes in the list.
g. Determine whether there are three integers \(x, y\) and \(z\) from the list so that \(x+y=z\).
h. Determine whether there are three integers \(x, y\) and \(z\) from the list so that \(x^2 + y^2 = z^2\).
i. Determine whether there are three integers \(x, y\) and \(z\) from the list so that \(xy = z\).
j. Determine whether there are three integers \(x, y\) and \(z\) from the list so that \(x^y = z\).
k. Determine whether there are two integers \(x\) and \(y\) from the list so that \(xy\) is a prime.
i. Determine the longest arithmetic progression in the list (a sequence (\(a_1,a_2,…,a_t\)) is an arithmetic progression when there is a constant \(d \neq 0\) so that \(a_{i+1}=a_i+d\), for each \(i=1,2,…,t−1\)).
m. Determine the number of distinct sums that can be formed from members of the list (arbitrarily many integers from the list are allowed to be terms in the sum).
n. Determine the number of distinct products that can be formed from members of the list (arbitrarily many integers from the list are allowed to be factors in the product).
o. Determine for which integers \(m\), the list contains at least 10% of the integers from \(\{1,2,...,m\}\).
2. If you have to put \(n+1\) pigeons into n holes, you have to put two pigeons into the same hole. What happens if you have to put \(mn+1\) pigeons into \(n\) holes?
3. Consider the set \(X=\{1,2,3,4,5\}\) and suppose you have two holes. Also suppose that you have 10 pigeons: the 2-element subsets of \(X\). Can you put these 10 pigeons into the two holes in a way that there is no 3-element subset \(S=\{a,b,c\} \subset X\) for which all pigeons from \(S\) go in the same hole? Then answer the same question if \(X=\{1,2,3,4,5,6\}\) with \(15=C(6,2)\) pigeons.
4. Let \(n=10,000\). Suppose a friend tells you that he has a secret family of subsets of \(\{1,2,…,n\}\), and if you guess it correctly, he will give you one million dollars. You think you know the family of subsets he has in mind and it contains exactly half the subsets, i.e., the family has \(2^{n−1}\) subsets. Discuss how you can share your hunch with your friend in an effort to win the prize.
5. Let \(N\) denote the set of positive integers. When \(f:N \rightarrow N\) is a function, let \(E(f)\) be the function defined by \(E(f)(n)=2^{f(n)}\). What is \(E^5(n^2)\)?