A selection of eight cards is dealt with every second card being returned to the bottom of the pack. Thus the top card goes to the table, card two goes to the bottom of the pack, card three goes to the table, card four to the bottom of the pack, and so on. This procedure continues until all cards are dealt.

The order in which the cards appear on the table is:

**A K A K A K A K**

How were the cards originally stacked?

If the number of cards is a power of 2, and if they are numbered sequentially, then you get first all the multiples of 1 that are not multiples of 2, then all the multiples of 2 that are not multiples of 4, then all the multiples of 4 that are not multiples of 8, etc.

For example, if there are cards numbered 1 to 32, they are dealt as follows:

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31

2 6 10 14 18 22 26 30

4 12 20 28

8 24

16

32