The Mathematics of Shuffling Poker Chips? First, I must say that I do not have an advanced understanding of mathematics and I don't know what category this question belongs in. This is just a question that I have been thinking about recently.
I've been teaching myself to shuffle poker chips and I noticed a weird trend. I decided to model it in C# and not only did I fail to answer my question, but it seemed to make less and less sense to me. 
So basically, this is what I did. I chose a certain number of chips, along with a certain number of colors, to see how many shuffles it takes to return to the initial form. The shuffles are the same simple shuffle everyone sees at a poker table. The chips are all grouped by color in the beginning and the condition to satisfy is a return to this initial position.
I did this for Chips ranging from 1-20, and colors ranging from 1 to 11. This is the data that I generated: http://i.imgur.com/ykG3BvO.png
I've looked at this paper: http://scott-n.com/Archives/Docs/Mathematical%20Trends%20in%20Binary%20Chipshuffling.pdf
It is a short paper that seeks to detail some of the trends that exist when using only 2 colors. 
Can anyone enlighten me on the subject? On the surface it seems relatively simple, but the more I look into it, the more difficult it becomes.
 A: Just as azimut's comment: I also don't understand your setup for more than two colors. However for two colors there is an answer. 
The answer for two colors
Let's say we have $n$ chips (in total, not per color) and we want to find the number of shuffles needed which we call $k$. 
There are two different ways how you can shuffle the chips: in-shuffles and out-shuffles, depending on which way you shuffle the chips:
In-shuffle:
RRRRBBBB => BRBRBRBR

Out-shuffle:
RRRRBBBB => RBRBRBRB

Basically, when doing an out-shuffle, the outermost chips never change position, and so $outShuffle(k) = inShuffle(k-2)$. For the following, I'll assume we are talking about in-shuffles
The number of shuffles is the smallest positive integer $k$ so that $(n+1)$ divides $(2^k-1)$. 
It can also be written as the smallest positive integer $k$ so that $2^k\equiv1 \mod (n+1)$
This is the same as the multiplicative order of $2 \mod (n+1)$. 
Explanation
This question can be explained with permutation group theory. Unfortunately, I can't give you a real explanation, nor a proof, but I can give you an idea how the formula I gave above can be explained. 
Easy case: 8 chips
Let's number the stack of chips from $1$ to $n$
12345678
RRRRBBBB

and let's then watch what happens to the chip on position $1$ over time. After one shuffle, we get the following picture:
12345678
BRBRBRBR

The chip from position $1$ is now on position $2$. Another shuffle later, it is on position $4$, then on position $8$, before returning to position $1$. So we have the cycle 
$
1\rightarrow
2\rightarrow
4\rightarrow
8\rightarrow
1$
of length $4$. 
However, not only does the chip from position $1$ follow this cycle. All 4 chips on this cycle are just rotating their places, which means that after 4 shuffles, they all return to their original place. The same happens with the other 4 chips, in another cycle. 
Consequentely, after 4 shuffles, the original position is restored. 
More complicated: 10 chips
Let's now check what happens with the first chip, when there are 10 chips in total. 
We get the following permutation: 
$
1\rightarrow
2\rightarrow
4\rightarrow
8\rightarrow
5\rightarrow
10\rightarrow
9\rightarrow
7\rightarrow
3\rightarrow
6\rightarrow
1$.  
The sequence has a length of 10, so it takes 10 shuffles to restore the original configuration. The question is however, what the mathematical structure behind this sequence is. 
If you examine this sequence more closely, you find out that the formula to get to the next position is $(pos*2)\mod11$. In general, this formula is $(pos*2)\mod(n+1)$. 
General case
The $k$th position of a chip can be calculated by duplicating it $k$ times, while calculating modulo $(n+1)$. 
The $k$th position of the first chip is though $2^k\mod(n+1)$. If and only if this is $1$, the first chip has returned to its position after $k$ shuffles. 
While this is by no means a complete proof, you can see that this might lead to the searched number being the smallest $k>0$ for which $2^k\equiv1\mod(n+1)$. 
What is missing


*

*Why can't there be a longer cycle than the one starting at position $1$?

*Why isn't there a situation in which the colors of the chips are right, even without the chips returning to their original position. 


See also


*

*A002326: Multiplicative order of 2 mod 2n+1 (here $n$ is the number of chips of one color, therefore $2n+1$ not $n+1$)

*xkcd forum thread about this topic
A: If each shuffle reorders the chips the same way, and all chips are different, this is just repeating a permutation (multiplying it by itself), so (by elementary group theory) the initial configuration does repeat eventually. If you divide the chips into undistinguishable groups (colors), the configuratins that are "the same" as the starting point are more, and you'll perhaps hit one of them before.
If the shuffle reorders chips in different ways, it is a random walk on the possible configurations. An interesting, but far from easy problem, is to compute the average time for repeats.
