纸牌重排
Cards Reordering
题目详情
一副纸牌的标准洗法如下:左手面朝下拿着整副牌,然后一张一张地把牌转移到右手。第二张放在第一张上面,第三张放在下面,第四张再放在上面,如此交替,直到所有牌都转移完毕。
如果你对一副偶数张的牌执行这个操作,并不断重复同样的洗牌方式,最终纸牌会回到最初的顺序。你可以试试 4 张牌,会发现洗 3 次后顺序恢复。事实上,当牌数分别是 2、4、8、16、32、64 时,恢复原顺序所需的洗牌次数分别是 2、3、4、5、6、7。
那么对于 14 张牌,需要洗多少次?
The standard procedure for shuffling a deck of cards is to take the pack face downwards in the left hand and then transfer each card one by one to the right hand, putting the second on top of the first, the third under, the fourth above, and so on until all cards are transferred.
If you perform this operation with an even number of cards and keep on repeating the shuffle in the same way, the cards will in due time return to their original order. Try with 4 cards and you will find the order is restored in 3 shuffles. In fact, where the number of cards is 2, 4, 8, 16, 32, 64, the number of shuffles to get them back to the original arrangement is 2, 3, 4, 5, 6, 7 respectively.
How many shuffles are necessary in the case of 14 cards?
解析
每次洗牌都可以表示为对 (14 个元素的对称群)中的一个置换。因为洗牌之后,每张牌都会被移动到牌堆中的另一个位置,所以整个洗牌操作可以看成是对 14 个位置的一次置换。用两行记号可写为:
把它改写成循环记号就是:
这是一个单独的循环,因为在走到最后之前没有任何元素会提前映回起点。因此,这个置换的阶为 14,也就是说需要洗 14 次,牌的顺序才会恢复到原始排列。
Original Explanation
Each shuffle can be represented as a permutation in , the symmetric group on 14 integers. This is because each of the cards is now permuted to some other spot in the deck, meaning that the shuffle operation can be represented as a permutation of 14 numbers. In two-row notation, this can be written as:
which, when expressed in cycle notation would be
This cycle is a disjoint one, as nothing maps back before the end. Thus, this permutation has order 14. This means that 14 shuffles are required to get the cards back to their original arrangement.