Let Nn be the number of permutations satisfying these conditions.
For n=5, the conditions are s4>s1 and s5>s2,s1. Among the 5! permutations of (1,⋯,5), half of them satisfy the condition s4>s1. Among these permutations, half of them satisfy also the condition s5>s2. Therefore, there are 30 permutations satisfying both conditions s4>s1 and s5>s2.
To compute N5, it is easier to subtract from 30 the number of permutations which do not satisfy the condition s5>s1. These permutations satisfy the condition s4>s1>s5>s2 with no condition on s3. Since there are 5 possibilities for s3, there are 5 such permutations and
N5=30−5=25
For n=7. There are more conditions and the method used for n=5 becomes complicated. That is why, we will use a different method based on an inductive relation for Nn.
For n=1,2,3 there are no conditions on the permutations. So
N1=1!=1,N2=2!=2,N3=3!=6.
For n=4, there is only one condition: s4>s1. This gives,
N4=214!=12
For n≥5, we have the conditions sn≥s1,s2,…,sn−3. This means that at most there are only sn−1,sn−2 at most which can be greater than sn. Therefore sn∈{n,n−1,n−2}.
(a) When sn=n, there are as many permutations as for n−1, that is Nn−1.
(b) When sn=n−1, because of the conditions sn≥s1,s2,…,sn−3, we have n∈{sn−1,sn−2}.
- If sn−1=n, there are as many permutations as for n−2, that is Nn−2.
- If sn−2=n, because of the conditions sn−1≥s1,s2,…,sn−4 we have sn−1∈{n−2,n−3}.
i. If sn−1=n−2, there are as many permutations as for n−3, that is Nn−3.
ii. If sn−1=n−3 then sn−3=n−2 and there are as many permutations as for n−4, that is Nn−4.
(c) When sn=n−2, because of the conditions sn≥s1,s2,…,sn−3, we have either sn−1=n,sn−2=n−1 or sn−1=n−1,sn−2=n. In each case there are as many permutations as for n−3, that is Nn−3.
Hence, we obtain the inductive relation
Nn=Nn−1+Nn−2+3Nn−3+Nn−4
Therefore
N5=12+6+3×2+1=25N6=25+12+3×6+2=57N7=57+25+3×12+6=124