A magician took a suit of thirteen cards and held them in his hand face down.

He took the top card off the pile and put it at the bottom , saying 'A' as he did it. He took the next card and said 'C' as he put it at the bottom. He took the next card and turned it over, saying 'E' as he did it - and the card was an ACE!

He carried on with the letters T-W-O and as he said the 'O' he turned over the card and it was a TWO!

He carried on with T-H-R-E-E, the FOUR and so on, and in each case as he said the last letter of the name he turned over the card and everyone was amazed that he had predicted what it would be.

How did this work?

Try with a slightly simpler version: Starting with ten cards numbered $1$ to $10$, can you arrange them in such a way that - starting with the arranged pile face down - you can spell out each card and reveal it as you announce its last letter?

Can you explain a way of doing this systematically so that you can quickly arrange any number of cards to make the trick work?

And the really hard bit: What would happen if you counted the number of cards equal to the value of the next card (so, if the next card was due to be a six - you would put five cards on the bottom of the pack and reveal the sixth)?