Skip to main content
2 of 2
added 563 characters in body
Ilya Bogdanov
  • 23.7k
  • 54
  • 92

We may assume that, at the beginning of the process, we first apply $P(1)$ which does nothing.

To learn what $a(m)$ is, revert the process as follows. Take the sequence $1,2,\dots,m,\dots$, apply $P(m)$, then apply $P(m-1)$, $\dots$, finally apply $P(1)$. After applying $P(m)$, the position of $m$ indicates where $a(m)$ stands in $PS(n-1)$; similarly, after applying $P(k)$, the position of $m$ indicates where $a(m)$ stands in $PS(k-1)$. So, after applucation of $PS(1)$, we get $m$ at position $a(m)$.

Now denote by $c(n,m)$ the position of $m$ in this reverted process after applying $P(m-n)$. So $c(0,m)$ is the position where $m$ comes after applying $P(m)$ to $1,2,\dots,m,\dots$; since $m$ stands at the start of the first moving block, it maps to position $2m-1$, being the last position in that block.

Similarly, when we apply $P(m-n)$ to a number at position $c=c(n-1,m)$, we look at the block it appears in. This block starts from $(m-n)\left[\frac{c}{m-n}\right]$, and the position of $c$ in it is $c\mod(m-n)$, where we assume that positions are numbered by $0,1,\dots,m-n-1$. The number comes to a position with number $(m-n-1)-c$ at the same block. this leads to $$ c(n,m)=(m-n)\left[\frac{c(n-1,m)}{m-n}\right]+(m-n-1)-(c(n-1,m) \mod(m-n))\\ =-1+c(n-1,m)+(m-n)-2(c(n-1,m) \mod(m-n)). $$ Now a straightforward induction ahows that $c(n,m)=b(n,m)+(n-m-1)$ for all $n=0,1,\dots,m-1$, which yields $a(m)=c(m-1,m)=b(m-1,m)$, as desired.

Ilya Bogdanov
  • 23.7k
  • 54
  • 92