Sep 25, 2012

USA Maths Olympiad Problem - 200th Puzzle

200th Puzzle of the CSE Blog

Source:
I got hold of the super awesome book I read 6 years back: "A Path to Combinatorics for Undergraduates: Counting Strategies". A must have for any math/olympiad enthusiast (Flipkart link to Imported Edition and Indian Edition) - Example 5.8 - USAMO 1990

Problem:
Let n be a positive integer. Find the number of positive integers whose base n representation consists of distinct digits with the property that except for the leftmost digit, every digit differs by +1 or -1 from some digit further to the left.

8 comments:

i have not worked out the exact answer but it can be solved in following way:choose a number belonging to{1,n-2} for the leftmost digit. Now for every next blank place there are exactly two choices of numbers provided the digit to immediate left is not 0 or n-1, if that is the case then for every remaining blank there is only 1 choice.If leftmost digit is n-1 then there is only one configuration possible.now add (n-2)(n-1) cases to get the answer

Let the symbols in base n be s[0],s[1]...s[n-1]Since all digits are to be distinct, therefore the number of digits in any number in solution set has to be <=n. So we will count number of solutions of each length and sum up.

If the length if L (1<=L<=N), and the smallest digit of the number N is s[i], then N must be a permutation of digits s[i] to s[i+L-1] only; because if an intermediate digit s[k] was missing in N, then the occurance condition of digits just smaller and just larger than s[k] in N (that it must occur first in number of must have some parent with +1 or -1) will clash at the starting digit of N.Thus for length L, N-L+1 selections are possible, and the problem reduces to : "How many permutations of P={1,2,3...L} satisfy the condition that except for the leftmost number, every number differs by +1 or -1 from some number further to the left"

And this problem can be solved fairly easily. Let i (1<=i<=L) be the first digit in a permutation. Then consider chains C1=i+1,i+2,i+3...L and C2=i-1,i-2,i-3...3,2,1Then in both chains, the previous digit has to come before the next one to satisfy the occurance constraint. This is simply the count of selecting |C1| positions from |C1|+|C2| (which is equal to L-1) positions and arranging both chains in order; which is C(|C1|+|C2|,|C1|) [where C(a,b) = combinatorial coefficient $^aC_b$ ]If i is starting number, there are C(L-1,L-i) ways. Summing for 0<=i<=L we get 2^(L-1)

Since L length had (N-L+1) selections, there are (N-L+1)*(2^(L-1)) number for length LSumming for all lengths 1<=L<=N, we get : COUNT = 2^(N+1)-N-2

I think the solution given above is partially correct except that, the numbers in base N starting with 0 are also counted. For base N numbers there can be only N numbers which start with 0. Subtracting that from the count gives the correct answer - 2( 2^N - N + 1 ).

Lemma 1: Number of n digit numbers that are formed using distinct digits from 0 to n-1 using each digit exactly once is 2^(n-1)Proof: Consider the last digit, convince yourself to the fact that the only two possibilities for the last digit are the numbers 0 and n-1. Then, proceeding in this manner, we have 2*2*2*...*2 = 2^(n-1) different numbers.

Lemma 2: Numbers of length k following above constraint contain digits that are consecutive i.e. a k length number following above constraint will have k consecutive digits (0--k-1 or 1--k or ...)Proof: Take any valid sequence. Let m denote the minimum element and M denote the maximum element.Now, case1: M is not the first element, in which case M-1 has to be in the sequencecase2: M is the first element, then at some position before m, m+1 has to be present, before which m+2 should be present. Continuing in this manner, we prove that M-1 has to be present at some position. Similarly using induction, we can prove that all numbers in the range m to M has to be present in the sequence.

Proof: So, we sum over all k length sequencesNow, one more thing has to be taken into account. If the k continuous numbers does not contain a '0', then number of k digit numbers will be 2^(k-1). IF the k continous digit numbers contain a '0', then number of k digit numbers will be 2^(k-1)-1 because 0 is not allowed to be at first position, which is possible in only one valid sequenceSo, at k digits, the number of valid sequences would be (n-(k-1))*2^(k-1) + 2^(k-1)-1So, we have summation of (n-(k-1))*2^(k-1) + 2^(k-1)-1 over k = 1 to n which is2^(n+1) - (n+2) + 2^(n) - 1 - n = 3*2^n -2n -3

Surprise! No correct solution. Someone should please improve the solution if my explanation is not good enough. Thanks

Correct answer: 2^(n+1)- 2n - 2

Solution:We apply a double recursion. Let a_n denote the number of suitable base n representations. Now we consider the suitable base (n+1) representations. These representations can be put into two disjoint classes:a) digit n is not in the representation; so this representation is also a suitable representation in base nb) digit n is the representation

Assume that there are b_(n+1) suitable representations in the second class.

Outline: 1) Consider the numbers in the set that consists of k digits exactly. Prove that those digits would be n, n-1, n-2, .. n-k+12) The two sets corresponding to k digit numbers in b_(n+1) and b_n are really the "isomorphic" (shift digits by 1). So, in summation, only the number of numbers with n+1 digits are left.3) The number of numbers with n+1 digits in the set represented by b_(n+1) is 2^nHence, b_(n+1) = b_(n) + 2^n and b_2 = 2Solving, b_(n+1) = 2^(n+1)-2

Amazon.com Mathematics Bestsellers

Buy me Coffee / Beer via Paypal/BTC

Pages

Search This Blog

Follow by Email!

About Me

I am an early stage technology investor at Nexus Venture Partners. Prior to this, I was a 3x product entrepreneur. Prior to this, I worked as a private equity analyst at Blackstone and as a quant analyst at Morgan Stanley. I graduated from Department of Computer Science and Engineering of IIT Bombay. I enjoy Economics, Dramatics, Mathematics, Computer Science and Business.

Disclaimer

This is a personal blog. Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity. Any views or opinions are not intended to malign any religion, ethnic group, club, organization, company, or individual.

All content provided on this blog is for informational purposes only. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.