Routaran
- 447
- 94
Hello,
I had a chat with a person at work and we were discussing a card shuffle and what governed its behaviour. Here's the shuffle rules.
Have to use an even number of cards
Take top and bottom card and make new pile
the next top and bottom card go below the new pile
Here's an example of a shuffle with 4 cards
1,2,3,4 <-- Original
1,4,2,3 <-- 1st Shuffle
1,3,4,2 <-- 2nd Shuffle
1,2,3,4 <-- 3rd Shuffle
As you can see on the 3rd shuffle, the cards return to their original order. We are trying to predict, given an even number of cards, how many shuffles it will take for the cards to return to their original order.
I wrote a VB Console application and calculated for all even numbers between 2 up to 32768. I graphed the data on a scatter plot and found that there's an upper and lower boundary that all the data exists in and there's other patterns as well.
The upper boundary is given by: y=x-1
The lower boundary is given by: y= (log2 x) -1
But we weren't able to find a single function that was able to predict what the number of shuffles would be, given an even number of cards. Any ideas on how to solve this?
I've attached 2 files:
A tab delimited text file containing data for number of cards/number of shuffles for all even numbers from 2 up to 32768
The source (in visual basic - Console program) for the program I wrote to calculate values (to verify that I didn't screw up in the data generation)
Cheers,
Routaran
I had a chat with a person at work and we were discussing a card shuffle and what governed its behaviour. Here's the shuffle rules.
Have to use an even number of cards
Take top and bottom card and make new pile
the next top and bottom card go below the new pile
Here's an example of a shuffle with 4 cards
1,2,3,4 <-- Original
1,4,2,3 <-- 1st Shuffle
1,3,4,2 <-- 2nd Shuffle
1,2,3,4 <-- 3rd Shuffle
As you can see on the 3rd shuffle, the cards return to their original order. We are trying to predict, given an even number of cards, how many shuffles it will take for the cards to return to their original order.
I wrote a VB Console application and calculated for all even numbers between 2 up to 32768. I graphed the data on a scatter plot and found that there's an upper and lower boundary that all the data exists in and there's other patterns as well.
The upper boundary is given by: y=x-1
The lower boundary is given by: y= (log2 x) -1
But we weren't able to find a single function that was able to predict what the number of shuffles would be, given an even number of cards. Any ideas on how to solve this?
I've attached 2 files:
A tab delimited text file containing data for number of cards/number of shuffles for all even numbers from 2 up to 32768
The source (in visual basic - Console program) for the program I wrote to calculate values (to verify that I didn't screw up in the data generation)
Cheers,
Routaran