General version: Given a number k > 1, find the smallest number n so that when 1,2,3,...,n put in any order, there are always k of them in increasing or decreasing order.
www.ddhw.com
This problem appeared at WXC yesterday. It does not look very difficult and should have a simple solution. But I did not find one. The solution I have is to solve the general version and then apply the result to 4.
对一般的情况类似讨论。可证明,当 n 不小于 (k-1)^2+1 时, 肯定有长度为 k 的升列或降列。
The following is my solution, which is not nearly as good. www.ddhw.com
For i, j >= 2, let M(i,j) be the smallest integer such that any sequence of length M(i,j) must contain an increasing subsequence of length i or a decreasing subsequence of length j. We prove inductively that M(i,j) <= (i-1)(j-1) + 1. www.ddhw.com
First we know M(i,2) = i. Now for j >= 3, form a subsequence this way: let a1 = smallest number in the sequence. a(k+1) = the smallest number after ak. If the length of the subsequece >= i, we are done. Otherwise we need an increasing subsequence of length i or a decreasing subsequence of length j-1 in the rest of the original sequence. Therefore we have M(i,j) <= M(i,j-1) + (i-1).
It is easy to see that M(i,j) >= (i-1)(j-1) + 1. So we will leave it as homework.
(Still remember in college days, whenever a professor met something he does not want to or forgot how to prove, or a question he does not know how to answer, he would leave it as home work. I don't know whether professors of nowadays, such as wild cauliflower, still do that. :) )
I consider myself a member of all three places. Two regular members at WXC, avanade, who posted the problem, and 梦回汉朝, apparantly knew the answer. Members here may also have known the answser.
Some regular members here, such as wild cauliflower, are too busy to solve more difficult problems. While the new members at WXC (the idiots) are very good. So it is hard to say which site is stronger now.www.ddhw.com