Maths Olympiad Prep

Library / /27 of 115

Combinatorics Difficulty 6.9 National olympiad Find the answer

Find, with proof, the number of positive integers whose base- nn representation consists of distinct digits with the property that, except for the leftmost digit, every digit differs by ±1\pm 1 from some digit further to the left. (Your answer should be an explicit function of nn in simplest form.)

A number or a short expression. Spacing and $ signs are ignored.

Solution

Let a kk -good sequence be a sequence of distinct integers {ai}i=1k\{ a_i \}_{i=1}^k such that for all integers 2ik2\le i \le k , aia_i differs from some preceding term by ±1\pm 1 .
Lemma. Let aa be an integer. Then there are 2k12^{k-1} kk -good sequences starting on aa , and furthermore, the terms of each of these sequences constitute a permutation of kk consecutive integers.
Proof. We induct on kk . For k=1k=1 , the lemma is trivially true. Now, suppose the lemma holds for kk . If {ai}i=1k+1\{ a_i \}_{i=1}^{k+1} is a (k+1)(k+1) -good sequence, then {ai}i=1k\{ a_i \}_{i=1}^k is a kk -good sequence which starts on aa , so it is a permutation of kk consecutive integers, say m,,Mm, \dotsc, M . Then the only possibilities for ak+1a_{k+1} are m1m-1 and M+1M+1 ; either way, {ai}i=1k+1\{ a_i \}_{i=1}^{k+1} constitutes a permutation of k+1k+1 consecutive integers. Since there are 2k2^k possible sequences {ai}i=1k\{a_i\}_{i=1}^k , and 2 choices of ak+1a_{k+1} for each of these sequences, it also follows that there are 2k2=2k+12^k \cdot 2 = 2^{k+1} (k+1)(k+1) -good sequences which start on aa . Thus the lemma holds by induction. \blacksquare
We now consider the number of desired positive integers with kk digits. Evidently, kk must be less than or equal to nn . We also note that the digits of such an integer must constitute a kk -good sequence. Since the minimum of this sequence can be any of the digits 0,,nk0, \dotsc, n-k , unless the minimum is 0 and is the first digit (in which case the only possible sequence is an increasing arithmetic sequence), and there are 2k12^{k-1} kk -good sequences up to translation, it follows that there are (nk+1)2k11(n-k+1) 2^{k-1}-1 desired positive integers with kk digits. Thus the total number of desired positive integers is k=1n[(nk+1)2k11]=n+k=1nj=kn2k1=n+j=1nk=1j2k1=n+j=1n(2k1)=2n1+j=0n2k,\begin{align*} \sum_{k=1}^n \bigl[ (n-k+1) 2^{k-1}-1 \bigr] &= -n + \sum_{k=1}^n \sum_{j=k}^n 2^{k-1} = -n + \sum_{j=1}^n \sum_{k=1}^j 2^{k-1} \\ &= -n + \sum_{j=1}^n (2^k-1) = - 2n -1 + \sum_{j=0}^n 2^k, \end{align*} which is equal to 2n+12(n+1)2^{n+1} - 2(n+1) , our answer. \blacksquare
Alternate solutions are always welcome. If you have a different, elegant solution to this problem, please add it to this page.

Want a route through all this instead of an archive? The track puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement and solution reproduced as published; topic and difficulty added by this site.