Problem (Gardner, 1983). Split cards into piles. A move takes one card from every pile and forms a new pile from them. If is triangular, show that from any start the piles become (and then stay there).
| Fact | Value |
|---|---|
| fixed point for | the staircase ; it is reached from every start |
| moves needed, triangular | at most (Igusa 1985, Etienne 1991), and this is attained for |
| , | ends in a cycle: the staircase plus extra cards on “diagonal ”, rotating; cycle length divides |
| method | Young diagram, diagonals, and a potential (energy) that never increases |
vector<int> bulgarianStep(vector<int> p) { // piles in non-increasing order
int k = sz(p);
for (auto& x : p) x--;
p.push_back(k);
p.erase(remove(all(p), 0), p.end());
sort(all(p), greater<int>());
return p;
}
int stepsToFixedPoint(vector<int> p) { // number of moves until the position repeats itself
sort(all(p), greater<int>()); int s = 0;
for (auto q = bulgarianStep(p); q != p; p = q, q = bulgarianStep(q)) s++;
return s;
}Proof: convergence to the staircase
Draw the piles as rows of a Young diagram, largest first: cell exists iff . Call the diagonal of a cell; diagonal has positions. Let the energy be .
A move is a rotation followed by sorting. Removing one card from each pile deletes column 0; the new pile has (number of piles) cards. Put it as row 0 and shift the old rows down by one: cell with goes to and cell goes to . Every cell stays on its diagonal; on diagonal the cell in row moves to row , and the one in row (column 0) wraps to row 0: a cyclic shift of the positions. If the resulting rows are not in non-increasing order (the new row is shorter than the next), sorting moves the new row down by adjacent swaps; each swap of a shorter row above a longer one moves the longer row’s extra cells up one row, onto the diagonal below. So never increases, and strictly decreases whenever sorting changes anything.
Eventually only rotations. is a non-negative integer, so after finitely many moves no more sorting happens and the position just rotates every diagonal. Suppose then that some diagonal has an empty position while diagonal has a cell. Their rotations have periods and , which are coprime, so by the Chinese remainder theorem at some time the hole sits at and the cell at , i.e. row 0 has a cell right of a gap. That is not a valid diagram, so sorting would occur, a contradiction. Hence in the final regime, a diagonal with a hole is followed only by empty diagonals: the cells fill diagonals completely, except possibly the last non-empty one.
Conclusion. For that means diagonals are full and nothing else: the staircase, which maps to itself. For with , diagonals are full and cells sit on diagonal , rotating with period dividing . The bound is the cited theorem; the search checked it, and that it is attained, for every partition with (), together with the cycle shape for every .
Related notes
- Invariants, Parity and Extremal Arguments (potential arguments)
- Stirling, Bell and Partitions (Young diagrams)
- Cycles and Functional Graphs (every deterministic process ends in a cycle)