Maths Olympiad Prep

Library / Saudi Arabian Mathematical Competitions /339 of 395

Saudi Arabian Mathematical Competitions

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+1−ai≤1a_{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 1≤i<j≤20161 \leq i<j \leq 2016 such that ai=ia_{i}=i and aj=ja_{j}=j.

Solution

For each positive integer n≥1n \geq 1, we denote sns_{n} as the number of permutations of the first nn positive integers that satisfy the condition
ai+1−ai≤1,i=1,2,…,n−1. 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=2n−1s_{n}=2^{n-1} for all n≥1n \geq 1.
Let kk be the index such that ak=na_{k}=n. We have ak−1≥ak−1=n−1a_{k-1} \geq a_{k}-1=n-1 which implies that ak−1=n−1a_{k-1}=n-1, and so on, we have a1=n−k+1a_{1}=n-k+1.
All numbers after aka_{k} are 1,2,3,…,n−k1,2,3, \ldots, n-k forming a nice permutation, so in case ak=na_{k}=n, the number of nice permutations is sn−ks_{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=1n−1sn−k=s1+s2+…+sn−1+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=2n−1s_{n}=2^{n-1} for all n≥1n \geq 1.

Back to the original problem, we suppose that ai=ia_{i}=i and aj=ja_{j}=j. Thus,
ai+1≤ai+1=i+1,ai+2≤ai+1+1≤i+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 aj≤ja_{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, ai−1≥ai−1=i−1a_{i-1} \geq a_{i}-1=i-1, but ai=ia_{i}=i, ai+1=i+1a_{i+1}=i+1 so ai−1≥i+2a_{i-1} \geq i+2. Then,
ai−2≥ai−1−1≥i+1 or ai−2≥i+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,…,ai−1≥i+2a_{1}, a_{2}, \ldots, a_{i-1} \geq i+2. Similarly, we also have ai+2,ai+3,…,a2016≤i−1a_{i+2}, a_{i+3}, \ldots, a_{2016} \leq i-1.
Therefore, the lengths of the two sequences a1,a2,…,ai−1a_{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,
i−1=2015−i⇔i=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
(a1−1009,a2−1009,…,a1007−1009). \left(a_{1}-1009, a_{2}-1009, \ldots, a_{1007}-1009\right).
Therefore, the number of permutations satisfying the given condition is
s1007⋅s1007=(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,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.