I had a proof but here, but it was wildly wrong.

So here's the right proof! I'm so proud of myself (core pats self on back)

It utilizes the power of modulus.. ooooohh :)

Take, say, position 20:

1st part ------- (20-7)=13 2nd part ------------ (13%3) =1, the second pile floor(13/3)=4, the position in the second pile 4+1*7=11 (11-0)=11 3rd part ---------------------- (11%3) =2, the third pile floor(11/3)=3, the position in the pile 3+2*7=17 (17-7)=10

Tada! Rinse and repeat, for every other starting position. You'll see it works out nicely.

Interestingly enough, the fact that this works out so nicely mathematically is completely irrelevant - you could pick the most erratic behaviour you like, and no matter how painful the math was, the proof will be trivial - just prove it for each possibility. When there are a finite, very small number of possibilities, things become really, really easy.

*note: there is still an error hidden in this proof. Find it and win a bon bon. (even with the error, the proof is still valid. Whenever modulus is involved, you have a lot of leeway...)