Find Function to fit data - Card shuffle

  • Context: Undergrad 
  • Thread starter Thread starter Routaran
  • Start date Start date
  • Tags Tags
    Data Fit Function
Click For Summary

Discussion Overview

The discussion revolves around the behavior of a specific card shuffle involving an even number of cards. Participants are exploring how to predict the number of shuffles required for the cards to return to their original order, based on empirical data generated from a program. The scope includes theoretical reasoning and mathematical modeling.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant describes the shuffle rules and provides examples, noting that the cards return to their original order after a certain number of shuffles.
  • Another participant suggests that the upper boundary for the number of shuffles should be x-1, based on their interpretation of the shuffle process.
  • A different participant counters that the pattern observed with 4 cards does not hold for all even numbers, providing a detailed example with 10 cards that shows a more complex shuffle sequence.
  • One participant introduces a notation for the shuffle process, indicating a potential relationship between the number of cards and the shuffle sequence.
  • A later reply seeks to connect the general representation of the shuffle to the specific number of shuffles required to return to the original state for any given number of cards.

Areas of Agreement / Disagreement

Participants express differing views on the applicability of the observed patterns across different numbers of cards. There is no consensus on a single function to predict the number of shuffles required, and the discussion remains unresolved regarding the generalizability of the findings.

Contextual Notes

Limitations include the dependence on specific examples provided (e.g., 4 and 10 cards) and the potential variability in shuffle behavior with different even numbers of cards. The mathematical steps to derive a general function remain unresolved.

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 [tex]1,2,...,x-1,x[/tex] and give output [tex]1,x, 2,...,x-1.[/tex] If that's the case, it seems like your upper-boundary should always be how long it takes, i.e. [itex]x-1[/itex]. Indeed, you're just leaving the first card where it is and cycling the other [itex]x-1[/itex].
 
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 [itex]x=2n[/itex], your shuffle takes [tex]t_1,...,t_n,b_n,...,b_1[/tex] to [tex]t_1,b_1,...,t_n,b_n.[/tex]
 
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?
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
9K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 19 ·
Replies
19
Views
7K
  • · Replies 2 ·
Replies
2
Views
3K