I have stack of x/2 green poker chips, sitting on top of x/2 red poker chips. When I shuffle my stack of chips, I separate the chips into the top half and the bottom half. I then alternate laying down a chip from the left and then right stack. How many times must I shuffle my stack of x chips such that they return to their original formation of green on top, red on bottom?
I've heard it takes forever to grow a woman from the ground
When you separate the big pile into two stacks, does the top pile go to the left or right stack? I'm sensing an off-by-one error If top -> left, then for x=1 the answer is 2, if top -> right, the answer is 1. --Tim
Joined: Apr 04, 2004
Let's start it of with an easy base: how many shuffles until the chips resegregate, with all of the chips of one color together, regardless of which stack is on top, and which is on bottom.
Joined: Apr 04, 2004
i forgot to mention: when one shuffles, one takes from the bottom of the stack, not the top. And now for a random, gratuitus smiley:
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Mar 15, 2004
You could argue that the answer is zero for all x, but I think you have to assume there's at least one shuffle. I'd say the answer for x = 2 is 1 :-) Meanwhile, I'm still tearing up bits of paper on my desk to use as poker chips :-/
Hey everyone- I made a program for this and figured it all out for all x up to 500. I don't see any pattern, and it's starting to bug me. Check out what I found at http://www.freewebs.com/sedatesnail . (Sorry, the program's not up yet, but the list is).
I'm new here, so I don't know if making a program is the "easy cop-out" answer... but it's all I've got. -Mario
Welcome!! IMHO, writing a program is not an "easy cop-out" answer. You're probably gonna get some funny looks around here since you say you wrote it in C++, and this IS the JAVA Ranch, but whatever!
your data is really interesting...
i especially find the places like
61 20 62 100 63 7
where adding 1 more chip makes such a drastic difference. i may have to think about this one some more...
Joined: Aug 19, 2004
Hey... oh yeah, the "Java Ranch" hehe. Well I only know C++ so far- I took one course in it in high school. I'll be learning Java as I start college in a few days... I just found this site on a Google search.
One thing that might affect it is the factors of each number... for example, multiples of 7 tend to take very few shuffles. Even numbers tend to take more shuffles than odd numbers. There are probably a bunch of other patterns like this. What's interesting is when the patterns collide... for example, 7's take few shuffles but 2's take many... then 14 takes a whopping 28 shuffles.
Also, it seems that the highest number of shuffles it can possibly take is double the number of chips.
This means that number of shuffles required for two stacks of 5 chips to return to there original position is 6. This is the same result we get when we actually try shuffling the chips. Try it for other numbers- it works!
By the way- for odd numbers, just use the equation 2^x-1= 0[modulo(n)], which will give you the same result as the even number of chips immediately following (# of shuffles for 5 chips = # of shuffles for 6 chips).
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com