home | index | units | counting | geometry | algebra | trigonometry & functions | calculus analysis | sets & logic | number theory | recreational | misc | nomenclature & history | physics

# Mathematical Magic

The universe is full of magical things, patiently
waiting for our wits to grow sharper
.
Eden Phillpotts   (1862-1960)

That must be wonderful !
I don't understand it at all
.
(Anonymous)

Any sufficiently advanced technology is indistinguishable from magic.
Third Law  of  Sir  Arthur C. Clarke  (1917-2008)

### Related Links (Outside this Site)

Beginner's Easy Magic Tricks
1089 and all that, by David Acheson   (Plus magazine, Sept. 2004)
Learn Free Magic Tricks   |   grand-illusions.com:  Illusions for sale.
Mindsights  by  Doug Dyment  (book for sale).

Economist and Magicianby  Laurence S. Moss (1944-2009).
Bibliography :
"Magical Mathematics"  by  Percy Diaconis  and  Ron Graham   (2012).

Videos :   Math Magic  by  Michael Stevens  (Vsauce, 2016-02-16).
Little Fibs  and  more  by  Colm Mulcahy  (Numberphile, 2016-06-02).

## Mathematical "Magic" Tricks

(2004-12-02)   1089
Pick a 3-digit number where the first and last digits differ by 2 or more... Why is this always equal to 1089?

This is one of the better tricks of its kind, because the effect of reversing the digits isn't obvious to most people at first...  If the 3-digit number reads abc, it's equal to  100a+10b+c  and the second step gives the following result:

| (100a+10b+c) - (100c+10b+a) |     =     99 | a-c |

The quantity  | a-c |  is between 2 and 9, so the above is a 3-digit multiple of 99, namely: 198, 297, 396, 495, 594, 693, 792 or 891.  The middle digit is always 9, while the first and last digits of any such multiple add up to 9.  Thus, adding the thing and its reverse gives 909 plus twice 90, which is 1089, as advertised.

Henri Monjauze (2008-02-07)   Multiples of nine
Pick a 2-digit number... How can the  magician  predict what that symbol is?

The trick will become boring  (or obvious)  if the same table is used repeatedly.  Thus, a new table must be provided each time.  Several online implementation do this quite effectively, with nice graphics.  Examples:

Magic Gopher  (British Council)

How fast can you discover the  secret  which makes this work?   [ Answer ]

Art Benjamin  (2010-05-29)   Casting out nines
Figure out the missing digit in a large product of two integers.

Effect :  The magician hands out a 3 or 4-digit integer chosen by a spectator in a previous part of the show.  Using a pocket calculator, another spectator multiplies that number by some secret 3-digit number which he chooses freely and keeps for himself.  The result is a 6 or 7-digit number.  The spectator withholds one of those digits and reveals all the others in a random order.  The magician then reveals the withheld digit!

The trick is based on arithmetic modulo 9, which is what underlies the process of casting out nines from an integer, which is very familiar to schoolchildren  (at least it used to be).  Casting out nines  is a quick way to obtain the remainder when an integer  N  is divided by  9  (the key observation is that 10 and all the powers of 10 leave a remainder of 1, therefore, a number and the sum of its digits leave the same remainder).  See elsewhere on this site for other  divisibility rules.

Secret :  The number handed out by the magician is a multiple of 9  (Art Benjamin takes it from a random list of perfect squares coming from a earlier stage of the show;  each of those has one chance in 3 of being divisible by 9 and the earlier stage went on until a "good" number came up).  The result is therefore a multiple of 9 and the sum of its digits is a multiple of 9.  When all the digits but one are revealed, the last one is thus known modulo 9.  This does reveal it unless it's either a zero or a nine.  In that ambiguous case, the magician will guess it to be a 9 and will almost always be right because people will rarely skip a zero when they are told to  skip any digit they like.  If you'd rather not take any chances at all, then instruct people to skip a  nonzero  digit...

A quick way to obtain the missing digit mentally is to first work out the remainder modulo 9 of the sum of the digits you are given  (just add together the digits and repeat, if needed, until you obtain a single-digit result).  Subtract the result from 9.  Done, unless you get zero  (in which case you'd guess "9" instead, as previously discussed).

Many variants of this trick can be devised based on any obscure process which produces a multiple of 9.  Here is one:

Ask a spectator to pick any 4-digit number and to consider the number obtained by reading it backwards.  Let the spectator secretly subtract the lesser number from the larger one, add 54 and multiply the result by a 3-digit number freely chosen by the spectator...

Ask how many digits there are in the final result and ask the spectator to keep one  nonzero digit  secret and to reveal the other digits in scrambled order.  (Count ostensibly on your fingers how many digits you are given to make sure you're only missing one.)

You may then call the remaining digit with perfect accuracy.

Videos :   Arthur Benjamin does Mathemagic at TED (February 2005)
Casting out nines with a deck of 40 cards  by  ScamSchool's Brian Brushwood  (crediting MIT Rob).

(2013-09-27)   The Triple Threat.  Mind Reading.
Guess with perfect accuracy which one of three cards was chosen.

The following effect can be repeated as many times as needed to convince the spectators that you can read their minds with perfect accuracy as they pick one of three choices.

### Effect :

Put three cards face-up on the table.  Ask a spectator to choose one  mentally  and remember its position.  Flip the three cards over.

Turn around and instruct the spectator to show the other spectators which card he has chosen, then have him switch the two  other  cards behind your back.

Now face the table again and instruct the spectators to switch cards as many times as they wish in front of your eyes.

Reveal the card originally chosen by the spectator.

### Secret :

Before you flip the cards and turn around, remember which card is in the middle.  When you face the table again, focus of the card which is now in the middle and keep track of its position as spectators move cards around.

Flip that card.

If this is the card you had memorized, simply announce that this is the card the spectators have chosen  (this is so because the spectator clearly hasn't switched the middle card behind your back in this case).  Otherwise, the chosen card can be neither the one you had memorized nor the one you're now seeing.  It's the third card.

Video :  Scam School  by Brian Brushwood, crediting Seth Rovner  (2010-06-16).

(2009-03-31)   Mass Media Mentalism
The magic of David Copperfield (1992)

In a 1992 TV show,  David Copperfield  turned simple-minded mathematical properties into something wonderful, for an audience who was (skillfully) led to expect magical things to happen.

Copperfield first asks you to take  N  steps forward and  N  steps back.  It doesn't matter what  N  is, does it?  Later, he says to go  halfway  around a circle in whichever direction you choose  (another type of irrelevant choice).

Regardless of the details of that show, it should be clear that a magician can only make predictions about outcomes which do not depend on the choices of his many spectators.  However, surprisingly many people want to believe in some irrational explanation.  This is what really scares  me.

Besides the visual effects and the drama, the challenge in designing such a collective effect is also to devise instructions that  everyone  can follow...

(2004-04-03)   Grey Elephants in Denmark
Mental magic  for classroom use...   [Single-use collective mentalism]

The teacher tells the class that a crowd can be driven to think about the same thing; very few people will escape the mental picture shared by all others...

Each student in the class is asked to think about a small number and is then instructed to perform the following operations silently.

• Double the number.
• Add 8 to the result.
• Divide the result by 2.
• Subtract the original number...
• Convert this into a letter of the alphabet. (1=A, 2=B, 3=C, 4=D, etc.)
• Think of the name of a country which starts with this letter.
• Think of an animal whose name starts with the country's second letter.
• Think of the color of that animal...

The teacher then announces to a puzzled classroom that their collective thinking must have gone wrong, since "there are no grey elephants in Denmark"...

Well, there  are  elephants in Denmark:  At this writing, the home of Kungrao (M), Surin (F) and Tonsak (F) is the Copenhagen Zoo...

The trick works in most parts of the World, but I wonder how many students from the Caribbeans would think of an "ostrich in Dominica" instead.

Michael Jørgensen (2004-03-24)   The 5-Card Trick of Fitch Cheney
How to reveal one of 5 random cards by showing the other 4 in order.

The 4! = 24 ways of showing 4 given cards in order would not be enough to differentiate among the remaining 48 cards of the pack.  However, since we may choose what card is offered for guessing, we have an additional choice among 5.  The resulting 120 possible courses of action are more than enough to convey the relevant information.  Here's one practical way to do so:

Consider two cards of the same suit  (among 5 cards,  at least  one such pair exists).  Let's call them the  base card  and the  hidden card, in whichever order makes it possible to go from the  base card  to the  hidden card  card by counting at most 6 steps clockwise on a circle of the 13 possible values.  (King is followed by Ace, Ace is followed by 2, 3, 4, etc.)

We offer the hidden card up for "guessing".  By revealing the base card first, we are telling the suit of the hidden card and we also set the point where a count of up to 6 "clockwise" steps is to begin to determine the hidden card.

The order in which the remaining 3 cards are presented can be used to reveal this count, as there are 6 possible permutations of 3 given cards.  Using some agreed-upon ordering of the cards in a deck, we hold a high card (H), a medium card (M) and a low card (L).  Some arbitrary code is used, like:

LMH = 1 ;   LHM = 2 ;   MLH = 3 ;   MHL = 4 ;   HLM = 5 ;   HML = 6

This trick is credited to Dr. William Fitch Cheney, Jr. (Fitch the Magician, 1894-1974)  who earned the first math Ph.D. ever awarded by MIT (1927).

The puzzle is presented in the 1960 book of Wallace Lee  entitled  Math Miracles  (chapter 14, as quoted by Martin Gardner)  and was popularized by the magician Art Benjamin in 1986.  It was used in a 1994 job interview and subsequently appeared on the rec.puzzles newsgroup, where Bob Vesterman posted the particular solution presented above  (1994-04-25).

In 1995, Robert Orenstein implemented Vesterman's encoding for online play at www.anamorph.com/docs/ct/cards.html  (a dead link resuscitated from the 2007 archives, courtesy of deadURL.com, on 2010-04-25).  For many years, that page was apologizing for having "temporarily" shut down its (terse) interactive features, since 2002-08-15.  Fortunately, that part was revived in the same terse form, by  Tom Ace,  an admirer of the trick who happens to be a software engineer.

The Best Card Trick  (PDF)  by Michael Kleber.  Mathematical Intelligencer 24 #1 (Winter 2002).
Fitch Cheney's Five-Card Trick  by Colm Mulcahy  (MAA Horizons, Feb. 2003).

Eric Farmer (2004-03-25)   [Generalization of the above]
Reveal n random cards (from a deck of d) by showing only k of them...

The previous article deals with k=4, n=5, d=52.  The case k=3, n=8, d=13 is called  Devil's Poker :  The Devil chooses 5 cards of a single suit and you present 3 of the remaining 8 cards one by one to an Angel who must guess the Devil's hand, using a  prior  convention between you and the Angel.

We have   k! C(n,k) = n!/(n-k)!   possible actions to reveal one of  C(d-k,n-k) compatible possibilities.  This task is only possible if the former exceeds the latter, which means that  n!(d-n)!  must be greater than or equal to  (d-k)! .

That means  k = n-1  in the case considered by Michael Kleber in the  aforementioned  Mathematical Intelligencer  article  (PDF).  In that case,  the above inequality boils down to:

d   <   n! + n

Kleber goes on to show that this necessary condition is  sufficient  to establish a working strategy.

(2006-05-01)   The Kruskal Count
Kruskal's card trick.

This trick is attributed to the physicist Martin David Kruskal  (1925-2006).  It illustrates a statistical feature which is amazing enough when one first encounters it.  Here's one way to present the effect:

If we use a regular deck of cards, we either remove the face cards or attribute to them the same value (1) as aces.  Beforehand, a player chooses  secretly  a special number N from 1 to 10.  As the cards from the deck are revealed one by one, the player counts cards and considers the N-th card revealed to be his  new  special number and keeps counting N cards from that one, and so forth...  All told, only a few cards are thus singled out as special.  The majority are not...

Yet, toward the end of the deck the dealer  (the magician)  can confidently point out that one particular card is "special"...

The same trick can be demonstrated by a clever dealer who just looks at the cards before dealing them and announces that a specific card  (which may then be flipped over and replaced in the deck)  will  turn out to be special.  You may play this version online with a computer which (honestly) shuffles the deck.  Allow yourself to be baffled a few times before reading on...

Well, the explanation is simply statistical.  For the sake of simplicity, let's consider the related case of an infinite sequence of cards, each bearing a positive integer  n  with probability  pn .

Two subsequences extracted with the above rules from an infinite sequence of digits (0 to 9) will eventually coincide, because if they coincide once they coincide forever  (think about it).

(2008-01-25)   Kruskal Paths to  God.   (Martin Gardner, 1999)
In the  U.S. Declaration of Independence,  all paths lead to  God.

In the  May 1999 issue of  Games MagazineMartin Gardner published the following puzzle, among a small collection of  some magic tricks with numbers.  It involves the first sentences of the  US Declaration of Independence :

 When in the Course of human Events, it becomes necessary for one People to dissolve the Political Bands which have connected them with another, and to assume, among the Powers of the Earth, the separate and equal Station to which the Laws of Nature and of Nature's God entitle them, a descent Respect to the Opinions of Mankindrequires that they should declare the causes which impel them to the Separation.

You are instructed to pick any word in the first (red) section of the text.  Then, skip as many words as there are letters in your chosen word.  For example, if you picked the fourth word ("Course") you have to skip 6 words ("of human Events, it becomes necessary") to end up on the word "for"...  Iterate the same process, by skipping as many words as there are letters in the successive words you land on.

What's the first word you encounter in the last (green) section?  Answer:  God.  Always.  (The sequence would continue with the words: descent, that, causes.)

The "magic" is based on the Kruskal principle discussed above...  You will ultimately land on  God  by starting with most words in the middle (yellow) section.  The words that do work have been underlined for you.  You may check that this underlining is correct by working it out (backwards) for yourself, starting with the last yellow words  ("and", "of") which do land on  God  in one step.  As any word which leads to an underlined word gets underlined itself, almost all words in the yellow section end up being underlined.  This includes the first 17 words of that yellow section.  Since all words of the red section have less than 17 letters, that solid chunk of underlined words can't be jumped over and, therefore, all paths starting in the red section will ultimately lead to the word "God" in the green section.  (Actually, any word up to the word "Station" is a valid beginning of a sequence which ends up on the word "God".)

Kruskal Count  by  Doctor Douglas  (2007-04-01)

(2009-01-08)  Cyclic Stacked Deck  (Si Stebbins, 1898)
A predictable deck of cards that  looks  disordered.
We'll only discuss here the most famous system of its kind.  It's named after  Si Stebbins  (William Coffrin)  who presented it in 1898 as his own invention, although it had been published as early as 1612.  Even earlier,  Horatio Galasso  wrote about a closely related system in 1593  (just using a numeric progression by constant increments of 4, instead of 3 for the  Si Stebbins).  More complicated schemes of the same family feature four distinct increments  (one per suit; the only restriction being that their sum shouldn't be a multiple of 13).

The ordering illustrated above and presented at right is also  revealed  at the end of a video posted by  Furrukh Jamal  presenting two related magic tricks.

Such a deck can be  cut  many times, but not shuffled  (seasoned illusionists could use  false shuffling ).

The value of the  Nth  card from the top  (face down)  is:

x   =   B  +  3 N   (mod 13)

Here,  B  is the value of the  bottom card.  The following numerical convention is used  (modulo  13):

 A J Q K 1 2 3 4 5 6 7 8 9 10 11 12 0 2 3 4 5 6 7 8 9 10

With the numerical code for suits given at the bottom of our main table, if  S  is the suit of the bottom card, then the suit of the  Nth  card is simply:

y   =   S + N   (mod 4)

For example, if the bottom card is the jack of diamonds  (B=11, S=0)  then the tenth card  (N=10)  is a  deuce  (since 11+3.10 is 41, which is equal to 2 modulo 13).  It's the deuce of  hearts  because  0+10  is equal to 2 modulo 4.

One trick is to have a spectator cut the deck.  You secretly look at the bottom card and call the card  3  units higher in the next suit  (from the  "CHaSeD"  sequence  Clubs, Hearts, Spades, Diamonds)  before revealing the  top  card.

### Find a Specific Card by Counting :

Conversely, the position  N  of the card  x  of suit  y  can be obtained from the Chinese Remainder Theorem  (a result N=0 would denote the bottom card).  Since  3N  is  x-B  modulo 13,  N  is  -4(x-B)  modulo 13  (HINT:  -4x3 is -12 or +1 modulo 13).  With that value of N modulo 13 and the value of N modulo 4  (namely y-S)  we may apply our explicit formula to solve the  Chinese Remainder Problem  and obtain N modulo 52 = 4x13, namely:

N   =   13 bezout (13,4) (y-S)  -  4 bezout (4,13) 4 (x-B)

Since  bezout (13,4) = 1 (mod 4)  and  bezout (4,13) 4 = 1 (mod 13) , that expression boils down to the following easy-to-memorize formula:

 N   =   13 (y-S)  -  4 (x-B)     (modulo 52)
The existence of such a formula makes the above far more flexible than other stacking schemes which lack arithmetic regularity  (including the infamous "Eight Kings CHaSeD" stack, which is merely based on the mnemonic sentence:  "Eight Kings threa-ten to save nine fair ladies for one sick knave"   for the order  8K3T2795Q4A7J).

For example, if the bottom card is the jack of diamonds  (B=11, S=0)  then the queen of hearts  (x=12, y=2)  is at the following position  (modulo 52):

N   =   13 (2-0)  -  4 (12-11)   =   22

The king of spades is at   N   =   13 (3-0)  -  4 (13-11)   =   31

The queen of diamonds is at   N   =   13 (0-0)  -  4 (12-11)   =   -4   =   48

The ace of clubs is at   N   =   13 (1-0)  -  4 (1-11)   =   53   =   1   (Isn't it?)

Preparation :   Here's a quick method to arrange the deck as above :

Mother of All Card Tricks Revealed  by  Furrukh Jamal   (Video)
Memorized Deck Online Toolbox  by  Scott Cram   (at "Grey Matters")
"SCAM School" videos :   Centuries Old Magician's SECRET Card Trick!  (courtesy of  Diamond Jim Tyler).
Learn an Insanely Easy Card Trick  (Spell:  COLOR, NUMBER, MATCHING-CARD)

(2012-04-28)   Amazing last trick with a stacked deck
A nice way to reveal the  Nth  card from a stacked deck.

The "Enigma" card trick performed by Andy Field revealed  by  Jay Mismag822   "The card-trick teacher"

(2009-01-11)   Magic Age Cards   (traditional set of 6 cards)
Tell the age of people (between 0 and 63) from the cards they pick.

Some traditional  magic age cards  forgo the numbers 61, 62 and 63  (so that only 29 or 30 numbers per card are required, which are printed in a  5 by 6  pattern,  with or without a star in the 30th position).  Full-range cards  (with 32 numbers printed on each card)  are more satisfying.  Here they are:

 32  33  34  3536  37  38  39 40  41  42  4344  45  46  47 48  49  50  5152  53  54  55 56  57  58  5960  61  62  63 16  17  18  1920  21  22  23 24  25  26  2728  29  30  31 48  49  50  5152  53  54  55 56  57  58  5960  61  62  63 08  09  10  1112  13  14  15 24  25  26  2728  29  30  31 40  41  42  4344  45  46  47 56  57  58  5960  61  62  63 04  05  06  0712  13  14  15 20  21  22  2328  29  30  31 36  37  38  3944  45  46  47 52  53  54  5560  61  62  63 02  03  06  0710  11  14  15 18  19  22  2326  27  30  31 34  35  38  3942  43  46  47 50  51  54  5558  59  62  63 01  03  05  0709  11  13  15 17  19  21  2325  27  29  31 33  35  37  3941  43  45  47 49  51  53  5557  59  61  63

Effect :   A spectator thinks of a number (up to 63) and tells you on what cards it is.

You call the exact number!

Secret :   The  weight  of each card is the smallest number printed on it.  Any number is equal to the sum of the  weights  of the cards it appears on.  For example:

52   =   32 + 16 + 4

This is just a straight consequence of binary numeration.  Each card actually shows all the numbers which have a "1" in their respective binary representations at a given position.  The binary representation of 52 being 110100, it appears on 3 cards and is equal to the sum of the 3 relevant powers of  2.  Voilà.

Magic Age Cards  (\$1.29 Party Trick)   |   Number Guessing Game  at Cut-the-Knot

(2009-01-14)   Ternary Cards
Tell the age of people (between 0 and 80) from the colors they pick.

This is my own improvement  (2009-01-14)  over traditional  "age cards".

The introduction of black and red colors allows a larger range of numbers  (80 instead of 63)  using fewer cards  (just 4 cards instead of 6).

 01  02  04  05  07  08 10  11  13  14  16  17 19  20  22  23  25  26 28  29  31  32  34  35 37  38  40  41  43  44 46  47  49  50  52  53 55  56  58  59  61  62 64  65  67  68  70  71 73  74  76  77  79  80

 03  04  05  06  07  08 12  13  14  15  16  17 21  22  23  24  25  26 30  31  32  33  34  35 39  40  41  42  43  44 48  49  50  51  52  53 57  58  59  60  61  62 66  67  68  69  70  71 75  76  77  78  79  80

Effect :   A spectator thinks of a number (up to 80) and tells you its color  (red or black)  on each card where it appears.

You call the exact number!

Secret :   For each color called by the spectator, add the smallest number of the  same color  on the card.  The total will be the secret number.

For example:

52   =   1 + 6 + 18 + 27

 09  10  11  12  13  14 15  16  17  18  19  20 21  22  23  24  25  26 36  37  38  39  40  41 42  43  44  45  46  47 48  49  50  51  52  53 63  64  65  66  67  68 69  70  71  72  73  74 75  76  77  78  79  80
 27  28  29  30  31  32 33  34  35  36  37  38 39  40  41  42  43  44 45  46  47  48  49  50 51  52  53  54  55  56 57  58  59  60  61  62 63  64  65  66  67  68 69  70  71  72  73  74 75  76  77  78  79  80

Those cards are based on  ternary  numeration:  In base 3, all numbers less than 81 are represented by 4 digits or less.  Each card shows the 54 numbers which have a nonzero digit at a specific ternary position.  If the digit is 1, the number is listed in  red.  If the digit is 2, the number is listed in  black.

(2009-04-05)   Magical 21
Ask  3  questions to find one card among 27 (or fewer).

This is a classic no-brainer.  Deal any odd number of cards up to 27 in three equal piles  (this means you're dealing 15, 21 or 27 cards, according to taste).  Ask what pile the chosen card belongs to and collate the cards so the chosen pile is in the middle.  Deal and collate again in the same way.  Deal one last time.  The chosen card will be in the middle of the selected row.  Reveal it in whatever dramatic way you like...

For a very fast effect, use just 9 cards and deal only twice  (although the underlying math for this 2-step trick becomes rather obvious).

Video 1   |   Video 2
"Numberphile" episode, filmed by Brady Haran:   Beautiful Card Trick  by  Matt Parker  (2012-11-26)

(2013-07-28)   The Final 3
What were the original positions of the 3 remaining cards?

For once, let's explain the effect  before  presenting a video performance.

One method of eliminating half the cards in a face-down deck is to flip-over every other card, starting with the topmost one, to form two piles and get rid of the face-up pile...

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17, ... 48,49,50,51,52.

The first elimination gets rid of the odd-numbered cards and reverses the order of the even-numbered ones:

52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2.

The second step leaves 13 cards face-down, in the following order:

2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50.

The third step eliminates every other card and reverses the order again:

46, 38, 30, 22, 14, 6.

The final elimination leaves three cards face-down:  6, 22 and 38.  In other words, the first of the "Final Three" was initially at position  6  (i.e., with 5 face-down cards on top of it)  and the other two appeared thereafter at regular intervals of 15 intervening cards...

In the video presentation below, the number 15 is prominent and the number 5 is the result of subtracting 4 from 9 = 52-(10+1+15+1+15+1)...  There are also two "false cuts" to give an impression of randomness.

Video :   The Final 3 "Amazing Card Trick"  by  Mismag822.

(2009-01-13)   Boolean Magic
You have two choices.  Choose  either  2  or  3...

Multiply your chosen number by  any  odd number and multiply the number you did not choose by  any  even number.  Add those two products together.

From that result, how can a magician  determine which number was chosen?

(2009-03-26)   Faro Shuffles   (cf. A024222)
8 perfect faro shuffles leave a deck of 52 cards unchanged.

### Even number of cards :

In a perfect faro shuffle of an  even  number of cards, the deck is split into equal halves which are then interweaved.

There are two ways to do the interweaving.  In an  out shuffle,  both the top card and the bottom card are unchanged  In a so-called  in shuffle  neither is  (the top card becomes second and the bottom card becomes next-to-last).

Out-shuffling  2n+2  cards is equivalent to in-shuffling the inner  2n  cards.

Faro Shuffle Tutorial   |   Faro Shuffle Explained

### Shuffling decks with an odd number of cards :

When the deck consists of an  odd  number of cards, the deck is split into a pack of  n+1  cards and a pack of  n  cards.

If the larger pack is on the bottom, then the bottom card always remains unchanged and we are simply faced with a faro shuffling of only the  2n  top cards.  So, only the case where the top pack is larger need be considered.  For an  out shuffle  that case is equivalent to an  out shuffle  of  2n+2  cards  (in an outshuffle of an even number of cards, the bottom card stays in place).  All told, the only case where the faro shuffling of an odd number of cards does not reduce trivially to the shuffling of an even number of cards is the following one:

In-shuffling of  2n+1  cards, cutting  n+1  cards from the top.

In such a shuffle, there's a pair of adjacent cards from the middle of the pack which remain adjacent at the bottom of the pack after the shuffle.  It's much less regular than the other type of faro shuffling.  Yet, some patterns appear:

The number  s  of such shuffles needed to return a deck of  n  cards to its original state is a complicated function of  n.  Remarkably, if  n  is  3  units below a power of  2,  then  s  is a simple quadratic function of the exponent  (usually, the ratio  s/n  is then much smaller than for any lesser values of  n).

   n   s   n   s 5 13 29 61 125 253 509 1021 2045 4093 ... 2k - 3 6 12 20 30 42 56 72 90 110 132 ... (k-1) k 7 15 31 63 127 255 511 1023 2047 4095 ... 2k - 1 10 56 90 132 182 240 306 380 462 552 ... 2 k (2k-1)

(2016-10-19)  Counting in binary, using perfect shuffles.
In at most 7 shuffles, put the  top card  at any given position in the deck.

If  n  is the number of cards  above  a given card in the top half of the deck,  then the number of cards above that same card becomes:

• 2 n   after an out-shuffle.
• 2 n + 1   after an in-shuffle.

Let's encode a sequence of perfect shuffles with a binary number  Q  where a "0" bit corresponds to an out-shuffle and a "1" to an in-shuffle.  For example, an in-shuffle followed by two out-shuffles corresponds to  "100"  (which is the binary expansion of the integer  Q = 4).

If  Q  is less than the number of cards in the deck,  the above remark can be used to show  (by induction on the number of shuffles)  that a sequence of shuffles of code  Q  moves the topmost card  Q  places down  (i.e.,  after shuffling, there are Q cards above the card which was originally on top).

Video :   52-Card Perfect Shuffles  by  Jason Davison  (in "Numberphile" by Brady Haran, 2015-03-27).

(2012-11-02)   Two heaps of coins.
Equal numbers of  heads.  Always !

This classical trick can be done with ordinary coins  (each side is either  heads  or  tails ).  However, it's simpler and  more spectacular  with coins whose sides are easy to tell apart from a distance.  Othello/Reversi  pieces  (discs)  are ideal for this:  They have a  white  side and a black one...

### The Effect :

Put all the discs on the table, flip some of them over, shuffle them.  Ask your spectators to do the same.  Explain the difference between shuffling the coins  (sliding only)  and flipping them over.  Now, turn around and tell the spectators to shuffle the coins behind your back  ("no flipping")  then announce that you will separate the whole mess into two heaps containing the same number of white discs  "using your sense of touch alone".

You do just that, very quickly  (using both hands to go faster).  Then put your hands up in the air and turn around  (in that order)  to check with the spectators that you've accomplished the  improbable.

Do it several times and the  improbable  will look like the  impossible.

### The Secret :

Before turning your back, you count the number  W  of white discs.

What you do behind your back is simply pick  W  discs randomly and  flip them over  as you put them flat on the table to form a  separate  heap.

### Why it works :

Consider any heap of  W  discs taken from a set that originally contained  W  white discs and  any number  of black ones.

If  x  is the number of white discs in that heap, then there are  W-x  black discs in it, which is precisely the number of white discs that you left in the  rest  of the set.

If you flip over  all  the discs in your heap, there are now as many white discs in it  (namely, W-x)  as in the rest of the set.

Videos :   Maths Puzzle: Coins   &   Maths Puzzle: Coins (Solution)   by  James Grime   (SingingBanana).

(2015-02-21)   Gilbreath's principle:  Simplified or full-blown version...
Some card patterns are preserved when a deck is  shuffled  by a spectator.

The basic principle featured here is named after  Norman L. Gilbreath  (a computer scientist and amateur magician, born in March 1936)  who is a;so remembered for Gilbreath's conjecture  which he rediscovered and popularized, 80 years after its first formulation by François Proth (1851-1879).

Gilbreath published a first version  (concerning only the black or red colors of cards)  in  The Linking Ring, 38, 5  (July 1958).  Introducing himself as a math-major UCLA student, Gilbreath named his effect  "Magnetic Colors".  Although this had been known to some magicians before, it was received as a major innovation by the Magic community.  So much so that, eight years later, an entire issue of  The Linking Ring  (June 1966)  would be devoted to Gilbreath magic.  In it, Gilbreatth himself presented a great generalization, now known as the  second principle of Gilbreath,  on which we are focusing here...

The general principle is that a certain type of shuffling which ends with an  honest  riffle-shuffle  (performed by a spectator)  will  always  preserve one particular aspect of a cyclic deck with respect to a separation of the deck into  n  equal classes  (e.g.,  2 colors, 4 suits, 13 values):  Even after such a shuffle, every "slice" of  n  cards still contains one card of every class !

The Gilbreath Shuffle :   Starting from a  cyclic deck  (cut any number of times)  the first step of a proper  Gilbreath shuffle  consists in separating the deck into two piles by  dealing out  one of them, thereby reversing the order of the cards in it  (you may pretend that you're counting the cards to "make sure" the piles are exactly even, although that's actually irrelevant).  The second step is to let a spectator riffle-shuffle those two piles together  once.

Why it works :   After a Gilbreath shuffle, the situation is exactly identical to what would be obtained if we had built the deck by successively picking a card either from the top or the bottom of the original deck  (at random).  Since slices of  n  cards are ordered alike at the top or the bottom of our cyclic deck, we always obtain a full slice of different cards after  n  picks, irrespective of the random choices made.  (The same basic situation repeats after a whole number of slices have been so obtained.)

In the case  n = 2  (for black/red colors only, as presented by Gilbreath in 1958)  it's an overkill to deal out one pile completely...  It suffices to make sure that the bottom cards in the two piles have different colors  (while preserving alternating colors).  This easy version is most often used by magicians  (see video clips in the footnotes below).

Here's  my way  to apply the  full  Gilbreath principle with a 52-card deck.  Slices of sizes 13 and 4 are used  simultaneously  in this example:

### Effect  (2015-03-09) :

Ask a spectator to take 12 cards off the top of the shuffled deck  and to  secretly  remove one of them.  The other 11 cards are then exposed.  You stress that you  clearly  can't tell their card for sure without seeing  all  the other 51 cards.  Yet, you guarantee to call it with perfect accuracy, by just peeking at the four top remaining cards...  Then, you do just that!

### Secret :

As the deck is initially cyclically stacked, the  second Gilbreath principle  applies:  The correct suit is the only suit which appears just 2 times  (not 3)  among the first 11 cards shown.  The value of the hidden card is the only value missing from the first 12 cards revealed  (the 11 cards originally shown and the  first  card turned over from the top of the remaining deck).

Yes, only the top card is needed; the extra ones just help conceal the secret!

Also, the first 11 cards allow you to determine the correct suit and leave a choice of only two values.  The correct value is whichever of those two  differs  from the value of the top card  (to be revealed next).  Thus, you can be ready to call the spectator's card  very fast  when the top cards are turned over  (all at once).  This speed-flourish enhances the effect's impact.

The First Norman Invasion  (MAA, August 2005)   |   The Second Norman Invasion  (MAA, August 2006)
Wikipedia :   Gilbreath shuffle
Videos :   Diagonal Attraction  by  Mismag822   |   Scam School  by  Brian Brushwood
Shuffling Card Trick  by  Jason Davison  (Numberphile by Brady Haran, 2016-03-02).

(2015-02-23)   Divination by counting  (from  any  52-card pack).
A self-working effect, originally designed by  Paul A. Lelikis  c. 1970.

This trick works by relating the number of cards in several piles to the values of their top cards.  The video by Brian Brushwood  (link in the footnote)  demonstrates the effect  and  shows how to perform it  (same thing really, for this particular effect)  but doesn't provide an explanation...  Here's one:

Well, in the last stage of the trick, each of the three face-down piles on the table contains  14-n  cards, where  n  is the value  (between 1 and 13)  of the top card.  If you deal out the number of cards indicated by that top card for two piles, each of them will have consumed a total of 14 cards.  Therefore, from the original 52 cards, 24 cards are left  (52-28)  which are either in your hand or in the remaining pile of  14-n  cards,  where  n  is the value of the face-down top card, which you have to determine...

So, if you have removed 10 cards from your hand at the outset, there's a total of 14 cards left.  As 14-n of those are in the "unknown" pile, you are holding exactly  n  cards.  Counting them reveals the value of the pile's top card.

Many variants of the same mathematical trick start with the construction of several piles containing  14-n  cards  ( n  being the value of each pile's own top card).  The key point is that, when one such pile is finally chosen, the number of cards outside of it is simply  38+n.  Thus, the real challenge in  designing  such an effect is to come up with some interesting method to get rid of  38  cards before the final count  (in a sufficiently obscure way).

(14-n)  +  (38+n)   =   52

Video :   The easiest card-trick ever  (Scam School)  by  Brian Brushwood.

(2015-04-15)   A card-counting trick from  Stu Ungar  (1953-1998)
Effect:  Tell the last card of a deck when all the others have been shown.

The secret is to assign a unique number to each card an know what the total for the whole deck is.  Mentally keep the running total of all the cards which have been shown.  When only one card remains, its number is obtained by subtracting that total from the known total for the whole deck.

If we use numbers from 1 to 52, the total for the whole deck is:

(52+1) 52 / 2   =   1378

The formula behind that calculation was discovered by Gauss when he was seven years old.

In practice,  it's easier to assign cards in each suit values from 0-12, 20-32, 40-52 and 60-72.  The grand total for  that  scheme is  1872.

Video :   Mike Sexton on Stu Ungar Counting Cards (3:02)  by  PartyPoker  (2014-09-10).