MathLabs

Problem 5

Given a permutation (a0,a1,…,an)(a_0, a_1, \ldots, a_n) of the sequence 0,1,…,n0, 1, \ldots, n. A transposition of aia_i with aja_j is called legal if ai=0a_i = 0 for i>0i > 0, and ai−1+1=aja_{i-1} + 1 = a_j. The permutation (a0,a1,…,an)(a_0, a_1, \ldots, a_n) is called regular if after a number of legal transpositions it becomes (1,2,…,n,0)(1, 2, \ldots, n, 0). For which numbers nn is the permutation (1,n,n−1,…,3,2,0)(1, n, n-1, \ldots, 3, 2, 0) regular?
Step 4 of 5: Prove the inductive transition Pr→Pr+1P_r \to P_{r+1} to establish n=2k−1n = 2^k - 1
In plain words

Think of Pr→Pr+1P_r \to P_{r+1} as an in-place merge sort: RR leftward sweeps peel elements one by one off every second block of size RR and weld them onto the adjacent blocks to form blocks of size 2R2R.

Pr→u=0,1,…,R−1Pr+1  ⟹  Pk=[1:2k−1],(0) for n=2k−1P_r \xrightarrow{u = 0, 1, \ldots, R-1} P_{r+1} \implies P_k = [1 : 2^k-1], (0) \text{ for } n = 2^k - 1
Detailed analysis

Suppose 2R∣N2R \mid N and we are at PrP_r. For each u=0,1,…,R−1u = 0, 1, \ldots, R-1 in turn, 00 sits right after R+u−1R + u - 1 and performs a leftward pass swapping successively with R+u,3R+u,…,N−R+uR+u, 3R+u, \ldots, N-R+u, which are the leading elements of the odd-numbered blocks after (0)(0). Each pass appends R+uR+u to the initial block [1:R+u−1][1 : R+u-1], transfers one element from each odd-numbered block to the end of the preceding even-numbered block, and shrinks the odd-numbered blocks by 11. After all RR passes (u=0,…,R−1u = 0, \ldots, R-1), the odd-numbered blocks vanish and the even-numbered blocks double to size 2R2R, yielding Pr+1P_{r+1}. When n=2k−1n = 2^k - 1, we have N=2kN = 2^k, so induction reaches Pk=[1:n],(0)=(1,2,…,n,0)P_k = [1 : n], (0) = (1, 2, \ldots, n, 0).