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 5 of 5: Rule out odd nn not of the form 2k−12^k - 1 and state the final answer
In plain words

Once the block size reaches the highest power of 22 dividing n+1n + 1, there are an even number 2b2b of blocks left after 00, which mimics the even-nn trap and lands 00 right behind nn.

n+1=2a(2b+1) (a,b≥1)  ⟹  Pa⟶([1:2a−1],…,[N−2a:N−1],0,…)n + 1 = 2^a(2b + 1) \ (a, b \ge 1) \implies P_a \longrightarrow ([1 : 2^a-1], \ldots, [N-2^a : N-1], 0, \ldots)
Detailed analysis

Finally, suppose nn is odd but not of the form 2k−12^k - 1, so N=n+1=2a(2b+1)N = n + 1 = 2^a(2b + 1) with integers a≥1a \ge 1 and b≥1b \ge 1. Since 2a∣N2^a \mid N, the same transitions lead from P0P_0 to PaP_a, where (0)(0) is followed by 2b2b blocks of size 2a2^a: [N−2a:N−1],[N−2⋅2a:N−2a−1],…,[2a:2⋅2a−1][N-2^a : N-1], [N-2 \cdot 2^a : N-2^a-1], \ldots, [2^a : 2 \cdot 2^a - 1]. In the very next pass, 00 swaps successively with 2a,3⋅2a,…,(2b−1)2a=N−2⋅2a2^a, 3 \cdot 2^a, \ldots, (2b-1)2^a = N - 2 \cdot 2^a. Because N−2⋅2aN - 2 \cdot 2^a is the first element of the second block [N−2⋅2a:N−2a−1][N - 2 \cdot 2^a : N - 2^a - 1], this swap places 00 immediately after the last element N−1=nN - 1 = n of the first block [N−2a:N−1][N - 2^a : N - 1], where the process halts incomplete. Hence the permutation is regular if and only if n=2n = 2 or n=2k−1n = 2^k - 1 for a positive integer kk.