Caching Combinatorics

Recently Arya the little panda got a permutation of size AAA as a birthday present from his parents. Being a crazy little panda, he decided to make some operations on it. In each operation he chooses some index i(1≤i≤n)i(1≤i≤n)i(1≤i≤n) and moves AiA_iAi​ to the front of the permutation.


This is a companion discussion topic for the original entry at https://toph.co/p/caching-combinatorics