This is the puzzle I want to solve today!
"A "perfect shuffle" is a trick used by card sharks and magicians to give the illusion of randomness when in fact the order of the cards is being controlled. It involves cutting the deck into two exactly equal halves, and then perfectly interlacing the two halves one card at a time.
For example, if the deck contains 52 cards numbers in order 1 to 52, the deck will be cut into a left half (numbered 1-26) and a right half (containing 27-52). They are merged, from the bottom up, starting with the bottom right card (52), then the bottom left card (26), then the next bottom right card (51), then card 25, 50, and so on. The deck will be in the order of 1, 27, 2, 28, ..., 25, 51, 26, 52.
Interesting fact: if you have a deck of 52 cards and repeat the perfect shuffle 7 more times, the deck will be back in the original starting order! So, for a deck of 52 cards, 8 perfect shuffles will leave the deck in the original order.
Challenge
Build an Excel workbook that will model a perfect shuffle for every even-size deck from 2 to 200 cards. What is the smallest number of perfect shuffles required to get the deck back in the original order?
For 4 cards, the answer is 2. For 52 cards, the answer is 8. What about the other deck sizes? Try to find the simplest and most elegant way of modelling this that you can. Try also to find interesting ways to display the answers and highlight any patters you may see emerging.
Bonus points if you can spot any pattern. Is there any way to model this for a deck size of 20,000 cards?"
There were lots of great puzzles on this site:
Jelen, Bill. “Perfect Shuffle Challenge.” Worksheet SelectionChange, Apr. 2013, www.mrexcel.com/challenges/perfect-shuffle-challenge/.
![](https://i.ytimg.com/vi/Z00Oc-M8P38/maxresdefault.jpg)