--------------------------------------- The input word is, [6, 2, 7, 1, 10, 11, 3, 5, 4, 8, 12, 9], of length, 12 its major index is, 29 The last letter is, 9, and the one before it is, 12 The chopped word, after deleting the last letter, 9, is : [6, 2, 7, 1, 10, 11, 3, 5, 4, 8, 12] whose number of inversions is, 18 Its major index is, 18 Applying the Foata bijection recursively, we get [6, 2, 7, 1, 10, 3, 11, 5, 4, 8, 12] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11, 3, 5, 4, 8, 12], of length, 11 its major index is, 18 The last letter is, 12, and the one before it is, 8 The chopped word, after deleting the last letter, 12, is : [6, 2, 7, 1, 10, 11, 3, 5, 4, 8] whose number of inversions is, 18 Its major index is, 18 Applying the Foata bijection recursively, we get [6, 2, 7, 1, 10, 3, 11, 5, 4, 8] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11, 3, 5, 4, 8], of length, 10 its major index is, 18 The last letter is, 8, and the one before it is, 4 The chopped word, after deleting the last letter, 8, is : [6, 2, 7, 1, 10, 11, 3, 5, 4] whose number of inversions is, 18 Its major index is, 18 Applying the Foata bijection recursively, we get [6, 2, 7, 10, 1, 11, 3, 5, 4] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11, 3, 5, 4], of length, 9 its major index is, 18 The last letter is, 4, and the one before it is, 5 The chopped word, after deleting the last letter, 4, is : [6, 2, 7, 1, 10, 11, 3, 5] whose number of inversions is, 10 Its major index is, 10 Applying the Foata bijection recursively, we get [2, 6, 7, 1, 10, 3, 11, 5] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11, 3, 5], of length, 8 its major index is, 10 The last letter is, 5, and the one before it is, 3 The chopped word, after deleting the last letter, 5, is : [6, 2, 7, 1, 10, 11, 3] whose number of inversions is, 10 Its major index is, 10 Applying the Foata bijection recursively, we get [6, 7, 2, 10, 1, 11, 3] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11, 3], of length, 7 its major index is, 10 The last letter is, 3, and the one before it is, 11 The chopped word, after deleting the last letter, 3, is : [6, 2, 7, 1, 10, 11] whose number of inversions is, 4 Its major index is, 4 Applying the Foata bijection recursively, we get [6, 2, 7, 1, 10, 11] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10, 11], of length, 6 its major index is, 4 The last letter is, 11, and the one before it is, 10 The chopped word, after deleting the last letter, 11, is : [6, 2, 7, 1, 10] whose number of inversions is, 4 Its major index is, 4 Applying the Foata bijection recursively, we get [6, 2, 7, 1, 10] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1, 10], of length, 5 its major index is, 4 The last letter is, 10, and the one before it is, 1 The chopped word, after deleting the last letter, 10, is : [6, 2, 7, 1] whose number of inversions is, 4 Its major index is, 4 Applying the Foata bijection recursively, we get [6, 2, 7, 1] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7, 1], of length, 4 its major index is, 4 The last letter is, 1, and the one before it is, 7 The chopped word, after deleting the last letter, 1, is : [6, 2, 7] whose number of inversions is, 1 Its major index is, 1 Applying the Foata bijection recursively, we get [6, 2, 7] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2, 7], of length, 3 its major index is, 1 The last letter is, 7, and the one before it is, 2 The chopped word, after deleting the last letter, 7, is : [6, 2] whose number of inversions is, 1 Its major index is, 1 Applying the Foata bijection recursively, we get [6, 2] ------------------------------------------------------------- Let's digress to see how it is done The input word is, [6, 2], of length, 2 its major index is, 1 The last letter is, 2, and the one before it is, 6 The chopped word, after deleting the last letter, 2, is : [6] whose number of inversions is, 0 Its major index is, 0 Applying the Foata bijection recursively, we get [6] ------------------------------------------------------------- Let's digress to see how it is done The output is, of course, [6] ------------------------------------------------------------------ Going back Since , 2 < 6, we have Case II The break-up of the output of the recursive step, [6], according to blocks is [[], [6]] And after the clever Foata interchange [[6], []] Catenating, and appending the last letter, 2, we get [6, 2] ------------------------------------------------------------------ Going back Since , 2 <= 7, we have Case I The break-up of the output of the recursive step, [6, 2], according to blocks is [[], [6], [], [2]] and after the clever Foata interchange [[6], [], [2], []] Catenating, and appending the last letter, 7, we get [6, 2, 7] ------------------------------------------------------------------ Going back Since , 1 < 7, we have Case II The break-up of the output of the recursive step, [6, 2, 7], according to blocks is [[], [6], [], [2], [], [7]] And after the clever Foata interchange [[6], [], [2], [], [7], []] Catenating, and appending the last letter, 1, we get [6, 2, 7, 1] ------------------------------------------------------------------ Going back Since , 1 <= 10, we have Case I The break-up of the output of the recursive step, [6, 2, 7, 1], according to blocks is [[], [6], [], [2], [], [7], [], [1]] and after the clever Foata interchange [[6], [], [2], [], [7], [], [1], []] Catenating, and appending the last letter, 10, we get [6, 2, 7, 1, 10] ------------------------------------------------------------------ Going back Since , 10 <= 11, we have Case I The break-up of the output of the recursive step, [6, 2, 7, 1, 10], according to blocks is [[], [6], [], [2], [], [7], [], [1], [], [10]] and after the clever Foata interchange [[6], [], [2], [], [7], [], [1], [], [10], []] Catenating, and appending the last letter, 11, we get [6, 2, 7, 1, 10, 11] ------------------------------------------------------------------ Going back Since , 3 < 11, we have Case II The break-up of the output of the recursive step, [6, 2, 7, 1, 10, 11], according to blocks is [[], [6], [2], [7], [1], [10], [], [11]] And after the clever Foata interchange [[6], [], [7], [2], [10], [1], [11], []] Catenating, and appending the last letter, 3, we get [6, 7, 2, 10, 1, 11, 3] ------------------------------------------------------------------ Going back Since , 3 <= 5, we have Case I The break-up of the output of the recursive step, [6, 7, 2, 10, 1, 11, 3], according to blocks is [[6, 7], [2], [10], [1], [11], [3]] and after the clever Foata interchange [[2], [6, 7], [1], [10], [3], [11]] Catenating, and appending the last letter, 5, we get [2, 6, 7, 1, 10, 3, 11, 5] ------------------------------------------------------------------ Going back Since , 4 < 5, we have Case II The break-up of the output of the recursive step, [2, 6, 7, 1, 10, 3, 11, 5], according to blocks is [[2], [6], [], [7], [1], [10], [3], [11], [], [5]] And after the clever Foata interchange [[6], [2], [7], [], [10], [1], [11], [3], [5], []] Catenating, and appending the last letter, 4, we get [6, 2, 7, 10, 1, 11, 3, 5, 4] ------------------------------------------------------------------ Going back Since , 4 <= 8, we have Case I The break-up of the output of the recursive step, [6, 2, 7, 10, 1, 11, 3, 5, 4], according to blocks is [[], [6], [], [2], [], [7], [10], [1], [11], [3], [], [5], [], [4]] and after the clever Foata interchange [[6], [], [2], [], [7], [], [1], [10], [3], [11], [5], [], [4], []] Catenating, and appending the last letter, 8, we get [6, 2, 7, 1, 10, 3, 11, 5, 4, 8] ------------------------------------------------------------------ Going back Since , 8 <= 12, we have Case I The break-up of the output of the recursive step, [6, 2, 7, 1, 10, 3, 11, 5, 4, 8], according to blocks is [[], [6], [], [2], [], [7], [], [1], [], [10], [], [3], [], [11], [], [5], [], [4], [], [8]] and after the clever Foata interchange [[6], [], [2], [], [7], [], [1], [], [10], [], [3], [], [11], [], [5], [], [4], [], [8], []] Catenating, and appending the last letter, 12, we get [6, 2, 7, 1, 10, 3, 11, 5, 4, 8, 12] ------------------------------------------------------------------ Going back Since , 9 < 12, we have Case II The break-up of the output of the recursive step, [6, 2, 7, 1, 10, 3, 11, 5, 4, 8, 12], according to blocks is [[6, 2, 7, 1], [10], [3], [11], [5, 4, 8], [12]] And after the clever Foata interchange [[10], [6, 2, 7, 1], [11], [3], [12], [5, 4, 8]] Catenating, and appending the last letter, 9, we get [10, 6, 2, 7, 1, 11, 3, 12, 5, 4, 8, 9]