Problem

Source: 2019 FKMO Problem 1

Tags: combinatorics



There are $n$ cards such that for each $i=1,2, \cdots n$, there are exactly one card labeled $i$. Initially the cards are piled with increasing order from top to bottom. There are two operations: $A$ : One can take the top card of the pile and move it to the bottom; $B$ : One can remove the top card from the pile. The operation $ABBABBABBABB \cdots $ is repeated until only one card gets left. Let $L(n)$ be the labeled number on the final pile. Find all integers $k$ such that $L(3k)=k$.