## Returning a Pack to the Same Order

Suppose we have an odd pack of P cards, and that it returns to its original order after S shuffles. First consider a card whose position from a reference card is originally n0, and which moves to nF n2, etc., in successive shuffles.

After one shuffle nt = 2n0 or 2n0 - P After two shuffles n2 = 2nt or 2nl - P

= 4n0 minus the largest multiple of P less than 4n0 = 4n0 - X2P After three shuffles n3 = 8n0 - X3P After S shuffles ns = 2sn0-XsP (1)

The pack returns to the same order after S shuffles, and therefore nQ = ns (2)

Xs, although unknown and varying with n0, must be an integer, and this last equation must be true for all values of nQ. Considering no =

This means that 2s - 1 must be divisible by P. We can see from equation (3) that this makes Xs integral for all values of n0, so it is a possible solution of the equation.

Thus, an odd pack of P cards returns to the same order after S shuffles if 2s - I is divisible by P. An even pack, In- or out-shuffled, will return to the same order in the same number of shuffles as the equivalent odd pack.

In a similar way to the above, by substituting for equation (2) nR = P - n0, we can show that an odd pack of P cards will reverse its order after R shuffles if 2R + 1 is divisible by P. An even pack reverses in the same number of shuffles as the equivalent odd pack. If, however, the even pack is out-shuffled, the top and bottom cards will still be in their original positions; i.e., these two cards do not reverse, though all the other cards in the pack will.

### Solving the Shuffle Equation

Pack of 2X cards—A pack containing a number of cards equal to a power of two is a special case. Thus, 2X cards out-shuffled are equivalent to an odd pack of 2" - 1 cards. These will return to the same order after S shuffles if 2s - 1 is divisible by P = 2X - 1. The obvious solution is S = x, so 2* cards retain their order after x out-shuffles. Similarly, we can show that 2X cards reverse their order after x in-shuffles. For example, a piquet pack contains thirty-two cards. An ordinary pack from which, in the course of a gambling demonstration, you have discarded the four royal flushes also contains thirty-two cards. Thirty-two is 25. Therefore, either of these two packs will return to their original order after five out-shuffles, and will reverse their order after five in-shuffles.

P is prime—In addition to the case of a pack of 2X cards, there is one other case when an immediate solution of the equation is possible. This is when P is a prime number; then 2P~1 - 1 is divisible by P. This is Ferinat's theorem, a theorem in the theory of numbers. Applied to the weave shuffle equation it means that when P is prime, P car ds will return to their original order in P - 1 shuffles. Incidentally, this is not necessarily the smallest number of shuffles required for the cards to return to their original order.

For example, fifty-two cards in-shuffled are equivalent to an odd pack of fifty-three. Fifty-three is a prime, and therefore fifty-three cards return to the same order after fifty-two shuffles. Hence, fifty-two cards return to the same order after fifty-two in-shuffles.

General method—This is the quickest all-round method. It uses the binary system, which would take too long to explain here, so I shall assume it is known. Express P (which of course is odd) in the binary system and write it down. Write it down a second time underneath, so that the final T of the lower expression of P comes under the farthest right '0' in the upper expression. Add the two together. If you get nothing but 'l's, stop right there. Otherwise, write P down again under the sum with the final '1* in P under the far thest right '0' in the sum. Again add. Carry on until you get a sum containing nothing but 'l's. The number of 'l's in the final sum is the necessary number of shuffles to bring P cards back to the original order.

For example, eleven in the binary system is 1011.

Going through the procedure described, we have...

1011 1011 110111 101 l 10001111 1011 100111111

1011_

### 1111111111

There are ten 'l's in the final sum, so eleven cards return to the same order after ten shuffles. Note that we get the same result from the last section, since eleven is a prime.

To find out how many shuffles are necessary for the cards to reverse their order, we write P down each time with its final *1* under the '1* excluding the final '1' farthest to the right in the sum, or expression of P above, until we get a sum in the form of 1000 - - -001. The necessary number of shuffles is one more than the number of '0*s. It is advisable to solve for S before trying for R, for although there is always a solution for S, there is not always one for R. When there is, of course, S = 2R.

For example, with eleven cards as before,

1011 1011 100001

There are four *0's, so eleven cards reverse their order in five shuffles.

0 0