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 1 of 5: Analyze the deterministic rule and check small values n=1,2n = 1, 2
In plain words

There are no choices to make: the game plays itself deterministically until 00 lands right behind nn and halts.

ai=0 (i>0)  ⟹  aj=ai−1+1;n=1  ⟹  (1,0),n=2  ⟹  (1,2,0)a_i = 0 \ (i > 0) \implies a_j = a_{i-1} + 1; \qquad n = 1 \implies (1, 0), \quad n = 2 \implies (1, 2, 0)
Detailed analysis

Whenever ai=0a_i = 0 with i>0i > 0, a legal transposition looks at the entry ai−1a_{i-1} immediately before 00 and swaps 00 with aj=ai−1+1a_j = a_{i-1} + 1. Thus at most one legal transposition is available at any moment, and none is possible if and only if 00 is preceded by nn (or i=0i = 0, which never happens since 11 stays at a0a_0 or ai−1≥1a_{i-1} \ge 1). For n=1=21−1n = 1 = 2^1 - 1 and n=2n = 2, the initial permutations (1,0)(1, 0) and (1,2,0)(1, 2, 0) are already equal to (1,…,n,0)(1, \ldots, n, 0), so both n=1n = 1 and n=2n = 2 are regular.