Maths Olympiad Prep

Library / /120 of 155

Combinatorics Difficulty 6.7 National olympiad Prove it Saudi Arabia

Find the number of permutations (a1,a2,,a2016)\left(a_{1}, a_{2}, \ldots, a_{2016}\right) of the first 20162016 positive integers satisfying the following two conditions:
1. ai+1ai1a_{i+1}-a_{i} \leq 1 for all i=1,2,3,,2015i=1,2,3, \ldots, 2015.
2. There are exactly two indices i<ji<j with 1i<j20161 \leq i<j \leq 2016 such that ai=ia_{i}=i and aj=ja_{j}=j.

Solution

For each positive integer n1n \geq 1, we denote sns_{n} as the number of permutations of the first nn positive integers that satisfy the condition
ai+1ai1,i=1,2,,n1. a_{i+1}-a_{i} \leq 1, \quad i=1,2,\ldots,n-1.
We call these permutations "nice".

First, we shall prove that sn=2n1s_{n}=2^{n-1} for all n1n \geq 1.
Let kk be the index such that ak=na_{k}=n. We have ak1ak1=n1a_{k-1} \geq a_{k}-1=n-1 which implies that ak1=n1a_{k-1}=n-1, and so on, we have a1=nk+1a_{1}=n-k+1.
All numbers after aka_{k} are 1,2,3,,nk1,2,3, \ldots, n-k forming a nice permutation, so in case ak=na_{k}=n, the number of nice permutations is snks_{n-k}.
Note that if k=nk=n, we have only 11 nice permutation: 1,2,3,,n1,2,3,\ldots,n.
Therefore, we get the following formula:
sn=1+k=1n1snk=s1+s2++sn1+1 s_{n}=1+\sum_{k=1}^{n-1} s_{n-k}=s_{1}+s_{2}+\ldots+s_{n-1}+1
It is easy to compute s1=1s_{1}=1, s2=2s_{2}=2, then by induction, we have sn=2n1s_{n}=2^{n-1} for all n1n \geq 1.

Back to the original problem, we suppose that ai=ia_{i}=i and aj=ja_{j}=j. Thus,
ai+1ai+1=i+1,ai+2ai+1+1i+2 a_{i+1} \leq a_{i}+1=i+1, \quad a_{i+2} \leq a_{i+1}+1 \leq i+2
and so on, then we have ajja_{j} \leq j. But in fact, aj=ja_{j}=j which implies that the equality must occur.
So ak=ka_{k}=k for all k=i,i+1,i+2,,jk=i, i+1, i+2, \ldots, j. But there are only 22 indices i,ji, j like that so we have j=i+1j=i+1.

Continue, ai1ai1=i1a_{i-1} \geq a_{i}-1=i-1, but ai=ia_{i}=i, ai+1=i+1a_{i+1}=i+1 so ai1i+2a_{i-1} \geq i+2. Then,
ai2ai11i+1 or ai2i+2. a_{i-2} \geq a_{i-1}-1 \geq i+1 \text{ or } a_{i-2} \geq i+2.
By the same way, it is clear to check that a1,a2,,ai1i+2a_{1}, a_{2}, \ldots, a_{i-1} \geq i+2. Similarly, we also have ai+2,ai+3,,a2016i1a_{i+2}, a_{i+3}, \ldots, a_{2016} \leq i-1.
Therefore, the lengths of the two sequences a1,a2,,ai1a_{1}, a_{2}, \ldots, a_{i-1} and ai+2,ai+3,,a2016a_{i+2}, a_{i+3}, \ldots, a_{2016} are the same. Hence,
i1=2015ii=1008. i-1=2015-i \Leftrightarrow i=1008.
So the given nice permutation looks like
(a1,a2,,a1007,1008,1009,a1010,a1011,,a2016). \left(a_{1}, a_{2}, \ldots, a_{1007}, 1008, 1009, a_{1010}, a_{1011}, \ldots, a_{2016}\right).
Clearly, the subsequence (a1010,a1011,,a2016)\left(a_{1010}, a_{1011}, \ldots, a_{2016}\right) forms a nice permutation of length 10071007 and the same with the subsequence
(a11009,a21009,,a10071009). \left(a_{1}-1009, a_{2}-1009, \ldots, a_{1007}-1009\right).
Therefore, the number of permutations satisfying the given condition is
s1007s1007=(21006)2=22012. s_{1007} \cdot s_{1007}=\left(2^{1006}\right)^{2}=2^{2012}. \square

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: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic and difficulty added by this site.