Find Function to fit data - Card shuffle

Routaran
Messages
447
Reaction score
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
 

Attachments

Mathematics news on Phys.org
If I understand correctly, you take input 1,2,...,x-1,x and give output 1,x, 2,...,x-1. If that's the case, it seems like your upper-boundary should always be how long it takes, i.e. x-1. Indeed, you're just leaving the first card where it is and cycling the other x-1.
 
No, this doesn't apply to all possible numbers of cards. In my example i used 4 cards and it appears this way. If I use 10 cards and do the shuffle, it no longer follows this pattern.
10 card example:
Code:
1	2	3	4	5	6	7	8	9	10 <-- Original
1	10	2	9	3	8	4	7	5	6  <-- 1st Shuffle
1	6	10	5	2	7	9	4	3	8  <-- 2nd Shuffle
1	8	6	3	10	4	5	9	2	7  <-- 3rd Shuffle
1	7	8	2	6	9	3	5	10	4  <-- 4th Shuffle
1	4	7	10	8	5	2	3	6	9  <-- 5th Shuffle
1	9	4	6	7	3	10	2	8	5  <-- 6th Shuffle
1	5	9	8	4	2	6	10	7	3  <-- 7th Shuffle
1	3	5	7	9	10	8	6	4	2  <-- 8th Shuffle
1	2	3	4	5	6	7	8	9	10 <-- 9th Shuffle
 
Okay, cool. That clarifies it.

So if x=2n, your shuffle takes t_1,...,t_n,b_n,...,b_1 to t_1,b_1,...,t_n,b_n.
 
yes, this appears represents each successive shuffle correctly for any number of n

How do I go from this general representation to figuring out how many shuffles it will take to get the original state for any given n?
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
I'm interested to know whether the equation $$1 = 2 - \frac{1}{2 - \frac{1}{2 - \cdots}}$$ is true or not. It can be shown easily that if the continued fraction converges, it cannot converge to anything else than 1. It seems that if the continued fraction converges, the convergence is very slow. The apparent slowness of the convergence makes it difficult to estimate the presence of true convergence numerically. At the moment I don't know whether this converges or not.

Similar threads

Replies
4
Views
2K
Replies
7
Views
7K
Replies
3
Views
3K
Replies
2
Views
3K
Replies
30
Views
6K
Replies
1
Views
1K
Replies
19
Views
6K
Back
Top