The Hidden Paw

7) The 27 Card Trick in Any Base

There is a lot of material about the 27 Card Trick on the web. The trick is found in my eBook as Trick 19 (Click Here). I recently posted a correction as the trick in the book contained severe errors. Click Here to download the rewritten trick. The document also contains links to YouTube videos showing how to conduct the trick.

Some pages also indicate that the27 Card Trick can be extended to use other than the ternary base used in most versions of the trick. The trick can also be extended to have an optional number of cards.

Only one reference I know of gave a detailed formula for such extensions:

The Twenty-Seven Card Trick” by Calvin T. Long

The Mathematical Gazette, Vol. 75, No. 473 (Oct., 1991), pp. 299-303

Published by The Mathematical Association

This can also be found in JSTOR if you have such access: www.jstor.org/stable/3619488

Matt Parker (Numberphile) on YouTube runs through the regular 27 Card Trick and then completes an example using 49 cards and base 7: www.youtube.com/watch?v=G_OuIVOGDr8&t=2s

He does not offer a solution to either although he does offer a solution to the 27 Card Trick in this clip:

www.youtube.com/watch?v=l7lP9y7Bb5g&t=401s

Procedure

Calvin Long states that you can extend the 27 Card trick in two ways:

Using a different number of cards than 27

Using a different base than 3

1) If b = the base you wish to use and R = the number of deals or distributions, you will need b^R cards.

2) The number of cards in each pile will = b^(R-1) cards.

3) The number of piles will be b^R / b^ (R – 1) = b^1 = b.

4) In the popular 27 Card Trick, b = 3 and R = 3 too. So, the number of cards = 3^3 = 27. 

The number of cards in each pile = 3^(3-1) = 9. 

The number of piles = b = 3. 

The number of deals (distributions or collections) is therefore R = 3.

5) The number N selected by your victim as the predicted position of the chosen card is restricted to be between 1 and b^(R-1) or 1 and 27 in the popular case. The numbers to be converted to the new based will range from 0 to b^(R-1) – 1 or 26 in the case of the popular 27 card trick.

6) The position of each selected pile will be 0, 1, 2,....(b-1) where 0 corresponds to the top position of a picked up pile and (b-1) corresponds to the position nearest to your palm. If there is a 0 in one of the digits of the converted (N – 1), the pile corresponding to that deal will be placed face down on top of all the other piles.

Therefore, each value in the above sequence corresponds to the position from the top where you should place the pile containing the chosen card. For example, if the chosen card was in Pile P and the digit for that round or deal was 4 (in any base), the Pile P needs to be placed with 4 piles on top of it, i.e., those in positions 0, 1, 2 and 3. That is what is meant by position 4.

The 49 Card Trick

Let us take the example in the video by Matt Parker. He chose b = 7 and R = 2.

There will be 7^2 = 49 cards

We need to distribute the cards R = 2 times

Each pile will have 7 ^ (2 – 1) = 7

We will then have b = 7 piles

The piles will be picked up according to the reversed base 7 value of N – 1 where N is the number selected by your victim.

Matt selects the number N = 13. This means the card will be after the 12th card. So, we express 12 in base 7.

Since base 7 has the following digit values 49,7,1, then 12 is expressed as 15. This is 1*7 + 5*1 where 1*7 = 1 * (7^1) and 5*1 = 5 * (7^0).

Here, we follow the 27 Card procedure and reverse the value of 15 to become 51.

Since we have b piles to organize in our hands, we remember that the bottom pile corresponds to the value 0, the one on top, 1, etc. as follows:

Top               0

Top – 1          1

Top – 2          2

Top – 3          3

Top – 4          4

Top – 5          5

Bottom          6

So whichever pile we get in the first distribution, it should go into the position 5 or the pile just above the bottom file. Another way of thinking about it. If the digit is 5, the position of Pile P is such that there are 5 piles above it. (Watch Matt do that).

In the second distribution, the pile with the selected card would go into the pile 1 or the one just below the top.

Now the card will be guaranteed to be after the 12th card.

Another example. We choose b = 5 and R = 2

We will have 5^2 = 25 cards

We will distribute the cards 2 times

Each pile will have 5 cards = 5 ^ (2 – 1) = 5 so we will have 5 piles

The piles will be picked up according to the reversed base 5 value of the number selected by your victim.

For example, our victim chooses N = 17. We need to convert 16 to base 5. This is 31. So, we convert that to 13. In the first deal, we need to place the pile P with the chosen card 1 pile below the top pile. In the second deal, the pile P should be placed 3 piles below the top pile, i.e., the 4th pile.

Another example. We choose b = 4 and R = 2

We will have 4^2 = 16 cards

We will distribute the cards 2 times

Each pile will have 4 ^ (2 – 1) = 4 cards so, we will have 4 piles

The piles will be picked up according to the reversed base 4 value of the number selected by your victim.

Say we select N = 7, then N – 1 = 6. In base 2 (binary), this is 12 (or 1 x 4 + 2 x 1). Reverse this and you will get 21.

In our first deal, pile P containing the selected card will be placed with 2 piles above it. In our second deal, it will be placed with 1 pile above it.

What about the case where b^R > 52?

There is no problem with that as the theoretical basis has little to do with the standard size of card decks. If you select b = 5 and R = 3, you would need b^R = 125 cards. It will work, that is, if you have the patience for dealing 125 cards 3 times.

Click Here to go to the Weekly Puzzles Summary Page