Finding the 'best' way in a card-arrangement-game

86 Views Asked by At

Let $n\ge 2\in\mathbb N$. Suppose that we have a card on which $1$ is written, a card on which $2$ is written, $\cdots$ , and a card on which $n$ is written. Now these $n$ cards are arranged from left in ascending order of the written numbers. Then, suppose that we need to arrange these cards from right in ascending order through the following operation.

Operation : Choose either "two adjacent cards" or "three adjacent cards". If you choose two adjacent cards, then change the order of them. If you choose three adjacent cards, then change the order of the rightmost card and the leftmost card of the three cards.

Then, here is my question.

Question : Lettin $M_n$ be the minimum times of the oparation needed to arrange the $n$ cards from right in ascending order, how can we find $M_n$?

Example : $M_4=4.$ For example, $$\underline{123}4\rightarrow 3\underline{214}\rightarrow \underline{34}12\rightarrow 43\underline{12}\rightarrow 4321.$$

Motivation : I've already found that the following inequality holds for all $n$. $$\left\lceil\frac{\lfloor\ n^2/2\rfloor}{4}\right\rceil\le M_n\le {\left\lfloor\frac n2\right\rfloor}^2$$ $$3\le M_5\le 4$$$$5\le M_6\le 9$$$$6\le M_7\le 9$$$$8\le M_8\le 16$$ where $\lfloor x\rfloor$ is the largest integer not greater than $x$ and $\lceil x \rceil$ is the smallest integer not less than $x$. However, I haven't been able to find the very value $M_n$ in general. Can anyone help?

By the way, $$\left\lceil\frac{\lfloor\ n^2/2\rfloor}{4}\right\rceil\le M_n$$ comes from both the fact that the sum of the 'distance' each number has to move is $\lfloor\ n^2/2\rfloor$ and the fact that the maximum sum of the 'distance' each number can move through the oparation is $4$.

On the other hand, $$M_n\le {\left\lfloor\frac n2\right\rfloor}^2$$ comes from the fact that ${\left\lfloor n/2\right\rfloor}^2$ is sufficient in the following way. $$1234\rightarrow 1432\rightarrow 4132\rightarrow 4312\rightarrow 4321.$$ $$12345\rightarrow 12543\rightarrow 52143\rightarrow 54123\rightarrow 54321.$$ $$123456\rightarrow 123654\rightarrow 163254\rightarrow 613254\rightarrow 615234\rightarrow 651234\rightarrow 651432\rightarrow 654132\rightarrow 654312\rightarrow 654321.$$