Tuesday, December 31, 2013

X-Ray Vision

We embark on the centennial year of Martin Gardner, the best friend mathematics ever had, with a seemingly-impossible, X-ray vision effect we feel he would have enjoyed. Gardner's extensive legacy inspired the theme of Mathematics Awareness Month 2014. The MAM2014 poster will be unveiled at 11:30am on Thursday 16th January 2014, at 11:30 a.m. at the MAA Pavilion in the exhibit hall at the Joint Math Meetings in Baltimore.

The card effect below is based on a clever probability-defying principle involving permutation cycle decomposition, which was learned from a boxes and prisoners puzzle popularized by Pete Winkler of Dartmouth College. Appropriately enough, Pete introduced it at Gathering 4 Gardner 7 in Atlanta in 2006. Much of what follows below grew out of discussions with Dan Kalman of American University; indeed it was Dan's idea to migrate this lovely puzzle to the card setting.

Inexact Iffy Verso


Twelve cards from a borrowed deck of cards are jumbled by an audience member, who then deals them into a neat face-up three by four array—something like what is shown here—while you avert your eyes for a while so that you do not see any card faces. Any Ace to Queen in mixed suits are used, but don't draw attention to that. Do emphasize that the cards were borrowed and mixed, so that there is no chance of marked cards being used.




Have any four cards of different suits singled out, and their names written down on a sheet of paper which is then folded over, before the cards are all turned face down. For the sake of argument, let's suppose 4H, JS, 2C, are 8D are the chosen ones. Finally, you turn back to face your audience.

"These twelve cards from a borrowed deck have been randomized," you say, adding, "Only those of you who viewed them before they were turned face down know where anything is. I'd like to introduce you to four special friends of mine, who have a knack for finding things on demand. Actually they have x-ray vision." Four people enter the room. In reality, they are accomplices of yours who've agreed in advance on a mathematical strategy for locating any cards they are asked to.

Continue, "If one of my friends were to look for the Heart written on the sheet, and we allowed her to peek at up to nine of the twelve cards, she'd have a 75% chance of finding it. If a second of my friends did the same thing for the Spade on the list, and he hadn't seen the outcome of the first search—let's assume the cards always start off in the same neat array—that would be an independent event. Hence, the chance that both of my friends would succeed would be 3/4 squared, which is only about 56%. My other two friends seek the remaining two cards noted—the Club and Diamond—in the same way. For all four to succeed would be even less likely, since 3/4 to the power of four is only about 32%. Yet, that's exactly what I think will happen, about three quarters of the time.''

Pause to let that sink in, before summarizing, "Yes, I'm saying that if four people independently do something with a 75% chance of success, all four will succeed almost 75% of the times. We're re-writing the rules of probability here. The secret is simple: They're really using their x-ray vision to gradually steer them to the correct cards. It's not perfect, but it's much more impressive that leaving things up to mere chance."

One of your friends steps forward, you introduce her and add that she's very good at finding specific Hearts via x-ray vision. The rest of your friends turn away. Stress that none of the four gets to see the results of anyone else's peeking.

The audience member looks at the sheet, and shows your friend the Heart on the list, the 4H. Your first friend peeks at up to nine cards in the array, stopping as soon as she finds the 4H. If she fails, you admit defeat and start all over, having the cards re-shuffled and re-dealt. If she succeeds, have your second friend shown the Spade on the list, and continue if he too succeeds in finding his target card. If your friends all peeked at random, then as explained above, the chance they'd all succeed would be only 32%. Here's the big surprise:

It turns out that there is a way to guarantee that all four
of your friends succeed about 73% of the time, on average.


Here is the strategy, explained in terms of the specific card array above. It is indeed the result of a kind of x-ray vision: a mathematically-enhanced vision which allows those in possession of this superpower to "see through" an array of card backs and locate a desired card more easily than seems reasonable.

First, let's agree to associate each position in a three by four array with a specific number 1-12. We suggest an easy-to-remember but not too obvious assignment such as this "reverse-Z":

04    03    02    01
05    06    07    08
12    11    10    09

The values of the cards which end up in those positions can be thought of as a permutation of the numbers 1 to 12. The array shown earlier is reproduced here for convenience. In practice, the cards are all face down. It's all about the card positions and values, suits play no role at all; the earlier fussing about selecting a card of each suit to locate is just a distraction from what's really going on. The "reverse-Z" convention, however, serves a real purpose: it should make it less likely for spectators to catch on to the peeking strategy soon to be explained.




The first person—who hopes to locate the 4H—starts by peeking at the 4th card according to the above convention, namely, the 6H. That suggests that for her second try she peeks at the 6th card on display, which is the QH. That in turn points to the 12th card for her third try, which is the 9H. For her fourth try she peeks at the 9th card, which is the 3D, then for her fifth try she peeks the 3rd card, which is the 2C, then for her sixth try she peeks at the 2nd card, which is the 7H. Her seventh try is the 7th card on display, which is the desired 4H. She has succeeded within nine tries.

The cards are restored to a neat face-down array and the second person now views the scene, having not witnessed the first person's peeks. He hopes to locate the JC, and hence starts by peeking at the 11th card, which in the above convention is the 10C. That suggests that for his second try he next peek at the 10th card on display, which is the AD. That points to the 1st card for her third try, which is the desired JC. He too has succeeded, as hoped for.

The third person hopes to locate the 2C, and starts by peeking at the 2nd card, which is the 7H. It can be checked that if the procedure outlined above is followed, the 2C is arrived at on the seventh peek. The fourth person hopes to locate the 8D, and starts by peeking at the 8th card, which is the 5S. The 5th card is the 8D, so the target card is arrived at on the second peek.

For the specific array depicted above, we can therefore say:


All four succeeded in finding their cards within seven tries,
by starting with a peek at the card at the position corresponding
to the target card's value, and then "following the trail."


Does it always work, within nine tries? Definitely not! But it works more often than not. The display above corresponds to the permutation that sends 1, 2, 3, ..., 12, to 11, 7, 2, 6, 8, 12, 4, 5, 3, 1, 10, 9, respectively. It can be checked that its cycle decomposition is (1 11 10) (2 7 4 6 12 9 3) (5 8): a product of a 3-cycle, a 7-cycle and a 2-cycle (the last being a transposition or inversion). Here 3 + 7 + 2 = 12, and there is a natural connection with the numbers of tries the four people needed above: 7, 3, 7, and 2, when seeking cards of values 4, 11, 2 and 8, respectively. The 4H and 2C are in the 7-cycle, the JS is in the 3-cycle, and the 8D is in the transposition. For this array, all twelve cards are findable within seven peeks, the AD and 10C only need three peeks, and the 5S only needs two. Moreover, had the 5S and 8D above been switched, each would have been discovered on the first peek, as the cycle decomposition would then have been (1 11 10) (2 7 4 6 12 9 3) (5) (8).

What can go wrong? Consider the next array, which only differs from the one depicted above by having the 9H and 10C switched.




This new display corresponds to the permutation that sends 1, 2, 3, ..., 12, to 11, 7, 2, 6, 8, 12, 4, 5, 3, 1, 9, 10, respectively. Its cycle decomposition turns out to be (1 11 9 3 2 7 4 6 12 10) (5 8): a product of a 10-cycle and a transposition. Hence ten of these cards, specifically the AD, JS, 9H, ..., 10C, will require ten peeks to locate using the suggested strategy.

The moral is that some arrays, namely those avoiding cycles of length greater than nine, will guarantee 100% success, whereas others will lead to certain failure. The question then arises, how many (or what fraction) are there of each type?

On page 3 of Pete Winkler's "Seven Puzzles You Think You Must Not Have Heard Correctly," a simple counting argument is given to show that the probability of a uniformly random permutation of 1-12 having a k-cycle (for k > 6) in its cycle decomposition is 1/k. Having such a long cycle rules out the possibility of having another, since the cycle lengths sum to 12. Hence, it follows that the probability of a random permutation of 1-12 having a 10-cycle, 11-cycle or 12-cycle is 1/10 + 1/11 + 1/12, which is roughly 0.2742. Thus, we can assert:


The probability of any number of people all finding pre-assigned cards
of different values from a random array of 1-12, within nine tries,
using the suggested strategy, is 1 - 1/10 - 1/11 - 1/12, or about 73%.


It's even more impressive if more than four people are involved, since it beats the odds more convincingly, but it's also too time consuming. The "one of each suit" approach taken above is just an attempt to keep audience interest up for four rounds of peeking.

Secondly, It's As Easy As ABC


 We now suggest an improvement on the above: a similar effect which can be pulled off with 100% certainty, but allowing fewer peeks. The probability of any number of people all finding their pre-assigned cards of different values from a random array of 1-12, within six tries, using the suggested strategy, goes down to 1 - 1/7 - 1/8 - 1/9 - 1/10 - 1/11 - 1/12, or about 35%. This is the setting of the problem adapted from Pete Winkler; allowing only half of the cards to be peeked at. It's remarkable that the probability of success is so much higher than the chances of four people finding all of their cards by just peeking randomly, which is (1/2)^4, or about 6%.

A way to ensure success every time for your four friends is to control the cycle structure of the initial array permutation. For instance, with only six peeks permitted, it would help if we could somehow arrange that there be a 6-cycle, as then there couldn't also be a longer one. To do this we need to change the rules a bit, and be able to think very fast on our feet.

Above we saw how a single switch of two cards turned a 7-cycle and a 3-cycle into an undesirable 10-cycle. The very same kind of switch can be used to break up a long cycle into two more desirable shorter ones. So suppose we proceed as before, throwing in a comment such as, "Mix the cards all you want, and deal them into a three by four grid, face up. Switch pairs of cards over and over to make sure they're really mixed up. Then I'll do one more switch for good luck." This time around, you get to see the card faces of course.

If your last switch is done with great care, the final array will not have any cycles longer than six, and total success will follow. It's important to do this before you have the four target cards written down, to allay suspicions that your switch is related to those selections. Nevertheless, human psychology being what it is, it's likely that the cards you switch will not be chosen as two of the four to be found! People will also worry here that you are somehow communicating information gleaned from your viewing the cards to your friends; this is not so, once the cards are all turned face down the four target cards are located solely on the basis of the peeks.

Here's an example. Suppose that the audience member mixes the twelve cards and deals them into a three by four array, then does several card switches, leading to this display:




This display corresponds to the permutation that sends 1, 2, 3, ..., 12, to 5, 8, 12, 11, 1, 9, 6, 2, 7, 3, 4, 10, which has cycle decomposition (1 5) (2 8) (3 12 10) (4 11) (6 9 7). This needs no adjustment—every card is findable within three peeks—but for the sake of consistency, switch any two cards within any of the five cycles shown; it's still guaranteed to lead to success.

Here's another example. Suppose that this is what you are faced with:




This corresponds to the permutation that sends 1, 2, 3, ..., 12, to 7, 12, 1, 4, 6, 8, 3, 11, 5, 2, 10, 9, which has cycle decomposition (1 7 3) (2 12 9 5 6 8 11 10) (4). This has an 8-cycle, which we now consider undesirable. Switching the final 10C with the midstream 5S turns out to break up the 8-cycle into the two 4-cycles (2 12 9 10) and (5 6 8 11).

Can something like this be done in general? Namely, the detection and breaking up of a too-long cycle? Yes, here's a better way than that done above, courtesy of Dan Kalman, which avoids working out the full cycle decomposition first. Mentally follow the cycle from the AD until it either ends or goes past a sixth card. If the latter, swap the seventh card in the cycle with the Ace. If, on the other hand, the Ace-generated cycle ends too early, mentally follow the cycle from the 2C (or the lowest-valued one that was not in the first cycle), and this time, if you reach a seventh card, simply switch it with the 2C. This forces a 6-cycle, so that as mentioned above, it doesn't matter what the rest of the cycle structure is.

If there is a too-long cycle in the initial arrangement, the chances of finding it in one or two tries as just suggested is high. Otherwise, i.e., if you don't find any long cycles, you can swap any two cards within a cycle you've already examined.

Applying this to the last example above, we'd start decomposing as (1 7 3) (2 12 9 5 6 8 11 ...) and switch the JS and 2C. As a result, we'd change the given arrangement to one whose cycle decomposition is (1 7 3) (2 12 9 5 6 8) (4) (10 11), effectively breaking up an 8-cycle into a 6-cycle and a transposition.

"Inexact Iffy Verso" is an anagram of "X-Ray Vision Effect," and "Secondly, It's As Easy As ABC" is an anagram of "It's As Easy As No Bad Cycles."

Colm will do mathemagic with card demonstrations at book signings for his new Mathematical Card Magic: Fifty-Two New Effects at the CRC Press booth at 3pm on both Thursday 16th and Friday 17th January, at the 2014 Joint Mathematics Meetings in Baltimore. Readers attending this meeting may also wish to drop by the Martin Gardner Centennial booth (number 629, right across from the MAA pavilion).

Thursday, October 31, 2013

The Sequence I Desire. Magic: When Divided, No Remainder

On 21 October 2013, Martin Gardner, the best friend mathematics ever had, would have turned 99. Card Colm was launched here back in Oct 2004, to honor his 90th birthday. Other birthdays of his have been causes for celebration too. So it seems appropriate, as Martin and the Card Colm he inspired enter their 100th and 10th years, respectively, that this month's offering is based on something learned from of a good friend of Gardner's, Dr. Irving Joshua Matrix, the greatest numerologist the world has ever known.

The $36 Gamble

Start by addressing your audience with words along the lines of, "We all know how to tell if a number is divisible by 2, 3, 5 or 9. It's also not hard to do in the case of division by 4, 6 or 8. Divisibility by 7 is trickier, of course, but don't worry, thanks to an ingenious alternative method learned from Art Benjamin, that's within reach too."

Continue, "We'll test out those divisibility rules using the digits in a randomly chosen large number. Let's keep a calculator on hand to check our work. I need a volunteer." Pause, as somebody steps forward. "Thank you! You'll determine a nine-digit number completely by chance, using cards from any suit of your choice, after you've shuffled the cards in this deck. That number might be a multiple of 9!, which is 362880, so that it would be divisible by all the digits from 1 to 9 inclusive, but it's not so likely. Instead, we'll focus on the first digit, then the first two digits, next the first three digits, and so on, checking if there is a remainder when each of these is divided by 1, 2, 3, respectively, each time. If there is a remainder, I'll pay you that much in cash. Think of it as a reward for the work you're about to do! Let X be the total amount I pay you. Probabilists call X a random variable, because how much I pay you varies depending on the randomness of the shuffling you're about to do."

Continue, "Of course every one-digit number is divisible by 1, so you can't win there. For the two-digit number we'll get looking at the first two digits of the nine-digit number you come up with, clearly there's a 1 in 2 chance that it will be even, in which case I'll owe you nothing, and also a 1 in 2 chance that it's odd, in which case it has remainder 1 upon division by 2, so I'll owe you $1. When we move on to the three-digit number we'll get looking at the first three digits of the nine-digit number you come up with, there's a 1 in 3 chance that it will be divisible by 3, in which case I'll owe you nothing. It's more likely to have remainder 1 or 2 when divided by 3, so I'll owe you $1 or $2. It gets more complicated as the number of digits we look at increases. At the very end, we'll check if the entire nine-digit number is divisible by 9. As before, if division by 9 leaves a remainder, say 5, then I'll give you $5. I guess, 8 times out of 9 there, I'll be paying you something."

Put a wad of $1 bills on the table, and say, "The way I see it, in the worst case scenario, I'll have to hand over $1 + $2 + $3 + $4 + $5 + $6 + $7 + $8. As any smart child knows—you don't have to have the brains of a young Gauss to work this out—that adds up to $9 x 4 = $36. I went to the bank this morning and withdrew exactly that much money, just in case, in $1 bills. Your goal is to get as much of it as you can. There are some interesting mathematical questions, such as, how much can you expect to win on average, and how much might your winning total vary overall? Let's leave those for the probabilists to worry about. You get one shot at this. What can go wrong? You can't lose!"

Beating the Odds Gods

A deck of cards is produced, and its faces flashed to the audience to show that it's well mixed. The volunteer is asked to name any suit, as you split the cards into four face-down piles. Let's suppose she says "Hearts." Now, have her shuffle those piles together. Those can be three riffle shuffles—starting with two piles at a time, twice, then shuffling the resulting half decks together—or the obvious four-pile extension of the triple rosette shuffle below, introduced here the last time.


Take the cards back and fan them face up again so everyone can see that they are now even more jumbled. Say, "We only need the Hearts of single-digit values, namely the Ace to 9," as you openly pull those out in the order in which they occur, to form a new face-down pile. Shuffle the rest of the deck one last time, and set those cards aside. Announce, "Here they are, the nine Hearts we need, your chosen suit in the random order determined by your shuffling." Lay them out in a face-up row, resulting in a display such as this:


With a piece of paper quickly cover up all all but the first card, commenting that 3 is of course divisible by 1 with no remainder. Next, slide the piece of paper to expose the eight, adding, "Now I see 38, which is even. Since there is no remainder upon division by 2, I don't owe you anything yet. Now slide the piece of paper to expose the Ace. Say, "Since the digits of 381 add up to 12, that's divisible by 3. Phew! How long can my luck hold out? Slide the piece of paper over once more, to expose the six. Say, "The last two digits of 3816 are divisible by 4, so 3816 itself is divisible by 4. Amazing! Feel free to check that with this calculator."

The next time you slide the piece of paper over, to expose the five, you end up with 38165, which is divisible by 5 since it ends in 5. Again, no cash is handed over since there's no remainder. When the next digit is exposed, you get 381654. Division by 2 yields 190827, and the digits of that number sum to 27, so it's divisible by 3, and hence 381654 is divisible by 6, without remainder.

It's not hard to guess where this is going. When the seventh digit is exposed, you get 3816547. This is the only tricky one to deal with. Using the Art Benjamin approach, we note that since 63 is divisible by 7, then 3816547 is divisible by 7 if and only if 3816547 + 63 = 3816610 is. That, in turn, holds if and only if 381661 is divisible by 7. Since 21 is divisible by 7, then 381661 is if and only if 381661 - 21 = 381640 is, which holds if and only if 38164 is. Continuing, we see that 38164 is divisible by 7 if and only if 38164 - 14 = 38150 is divisible by 7, if and only if 3815 is, if and only if 3815 + 35 = 3850 = 7 x 550 is. So all of these numbers are divisible by 7, and there is no remainder when 3816547 is divided by 7. This too can be verified with the calculator.

Exposure of the eighth digit reveals 38165472. Division by 2 yields 19082736, whose last two digits are 36, so that's divisible by 4 and the original number is divisible by 8.

Say, "You have one more chance to win between $1 and $8 from me, are you ready?" The entire random nine-digit number is 381654729, whose digits sum to 45, so it's divisible by 9 without remainder. Your $36 remains on the table, untouched. You've beaten the odds gods and escaped unscathed. Conclude, "Weird, what are the chances of that happening? Every single time, when divided, there was no remainder! I'll ask my probabilist friends what kind of random variable X is. A very lucky one I guess, at least for me. I wonder what its standard deviation is?" Pocket the $36 on the table.

Imperviously Nibbled

The deck is of course rigged, and in such a way that the indicated handling still leads without fail to 381654729, the unique nine-digit polydivisible number using each of 1 to 9 just once. The Answers and Commentary section for Chapter 21 of The Magic Numbers of Dr. Matrix reveals that while Jaime Poniachik of Buenos Aires had first posed to the author the problem of finding such an arrangement of the digits 1 to 9, it was his wife Lea Gorodisky who had invented it.

Start by separating the deck by suits, and setting aside the sixteen cards of no interest, namely the 10s, Jacks, Queens and Kings. For each suit, arrange the Ace to 9 in order 381654729, cutting three of the resulting four piles in notably different places. In each of the four resulting piles, insert three of the Jacks, Queens and Kings randomly, spread out and aiming for good colour variation to withstand a casual glance later. Put a red-dominant twelve-card pile face down on the table, adding a 10 on top, then put a black-dominant pile on top of that, followed by two 10s, another red-dominant pile, the final 10, and then the last, black-dominant pile.

At showtime, this carefully arranged deck can be quickly fanned face-up to the audience as you ask for a suit to be named. Split it half, seeking the two 10s in the middle for guidance; the split should be within one card of the gap between those. Pick up the first pile, saying, "Hearts, eh?" as you scan the faces once more and split into face-down quarter decks using the buried 10 as a guide. Quickly repeat for the other half deck, adding, "I'm going to ask you to shuffle these to mix them up even further."

Whether the shuffling now done by the volunteer is riffling or rosetting, the case k = 4 of the solitaire principle explained here two months ago comes to the rescue:
  • If four piles of cards, one for each suit, each running in some fixed order, are rosette shuffled together, and the cards in the resulting packet are dealt one at a time into piles separated by suit, then the original piles will be reformed, in reverse order.
The key cards (Ace to 9) within each suit didn't start in the same order, to reduce the risk of early detection by an alert audience, but it doesn't matter. Cyclically, all is well. Upon receiving the deck back after the shuffle, while scanning and fanning again to show randomness, discretely cut anywhere between the 9 of Hearts and 3 of Hearts and reassemble the resulting two parts in reverse order. Then, when you pull out the nine desired Hearts, they will emerge in the right order. Nothing can go wrong.

Nothing, indeed, unless you can't remember the sequence of numbers central to the whole effect. One way to come up this most magic number of Dr. Matrix, as remarked in the book referenced above, is to note a pleasing geometric pattern when the digits in question are traced out in the unique magic square of order 3. If that's too much work, or you can't remember that magic square either, you can always count on the title of this column: The Sequence I Desire. Magic: When Divided, No Remainder.

"Imperviously Nibbled" is an anagram of "Polydivisible Number."

Colm is giving a public lecture on mathematical card magic at American University, at 7pm on Fri, 8 Nov, co-sponsored by the MAA, after which there will be a booksigning for Mathematical Card Magic: Fifty-Two New Effects (AK Peters/CRC Press).

Friday, August 30, 2013

Rosette Shuffling Multiple Piles

Mathematical Card Magic: Fifty-Two New Effects (AK Peters/CRC Press) is finally out. It has sizable overlap with the past nine year's worth of Card Colms here—about 75%?—but is organized quite differently. It's also written for a wider audience and generally avoids technical language. What follows is a taster of one of the nagging questions addressed in it, first publicly raised two years ago in A Call For A New Shuffle Principle (Need Rot Sextet?).

Limit Plus Peel

Some observations and assertions of a mathematical nature are easy, or at least routine, to generalize from two to three or beyond. Others are trickier (e.g., cake cutting), and a few turn out to be impossible (e.g., angle trisection using only a straightedge and compass). In the August 2011 Card Colm mentioned above, we made an appeal for a new kind of generalization of the ever-popular Gilbreath shuffle principle, asking

Is there a way to riffle shuffle three or more piles of prearranged cards
and expect some order to remain, without assuming perfect interweaving?

The good news is that this month we have something to report along these lines. We can now sleep at night, although a really impressive magic application is still proving elusive.

Treeless Shutoff

First it pays to switch our focus from riffle shuffling—which in the Gilbreath context follows the dealing out of some cards from a packet to form two piles—to something equivalent to that, which has a more obvious generalization to three or more piles. We're referring to Lennart Green's rosette shuffle as depicted below. Two side-by-side piles are twirled into rosettes with the fingers before being pushed together and squared up.



When we say that this is equivalent to riffle shuffling we really mean that the following internal coherence or solitaire principle applies.
  • If two piles of cards, running Ace to King of Hearts and Ace to King of Spades, respectively, are riffle or rosette shuffled together, and the cards in the resulting packet are dealt one at a time into two piles separated by suit, then the original piles will be reformed, in reverse order.
In other words, we'll never be faced with dealing the 7 of Hearts onto a Red card other than the 6 of Hearts. By the time we get to that 7, we can be sure that the Ace, 2, 3, 4, 5 and 6 of Hearts will already have been dealt, in that order.

Sheaf Bullfighters

In the first August edition of Card Colm, back in 2005, we explored the first (or basic) Gilbreath principle from 1958, which concerns the structure retained when two piles of cards are riffle or rosette shuffled, assuming that we start with an alternating packet of some kind and then deal "about half" of the cards to the table to give rise to the two piles. Generalizing that to situations where the packet started by repeating a cyclic pattern of length greater than two leads easily and naturally to the second (or generalized) Gilbreath principle from 1966, which we covered here in August 2006.

In a nutshell, the Gilbreath Principle says that
  • If we start with a packet of sm cards that consists of m repeated stacks of a particular set of s cards, each set being in the same fixed order with respect to some characteristic of interest (such as color, suit, or value), and we count out some of these to the table—thereby reversing their order—and then riffle shuffle together the two resulting piles, we're sure to get a packet in which each stack of s cards pulled off the top contains exactly one card of each of the key types, in some order.
The basic case is when s = 2. If the cards alternate Red and Black, over and over, at the outset, then the shuffled packet has the property that the cards in positions 1-2, 3-4, 5-6, etc, are always of different colors, though we can't say in which order Red and Black cards occur in each such pair.

For the case s = 3, we could start with a packet consisting of trios of Spades, Diamonds, and Hearts, in that order, over and over. The shuffled packet then has the property that the cards in positions 1-3, 4-6, 7-9, etc, always consist of one each of those three suits, again in some order. When s = 13, starting with a packet consisting of four stacks of the thirteen card values, in the same fixed order, we end up with four clumps (the cards 1-13, 14-26, 27-39 and 40-52) consisting of the thirteen values in some mixed order.

Lovely though all of this is—and it has spawned a ton of magic over the last half century—it's well-explored territory. What more is there to say? Persi Diaconis & Ron Graham give a complete characterization of such matters in what they call The Ultimate Gilbreath Principle on page 70 of their beautiful, inspirational and prize-winning book  Magical Mathematics: The Mathematical Ideas that Animate Great Magic Tricks (Princeton University Press, 2011). Some Gilbreath variations were considered here in subsequent Augusts, in The Bligreath Principle (2009) and Gilbreeath Shuuffling (2012). Just six months ago we couldn't resist sharing a new twist on all of this due to John Hostler in Flushed with Embarrassment (February 2013). Normal Gilbreath's own long-awaited book is coming soon, from L&L Publishing.

But there is another direction in which to turn, in search of a different kind of thrill. What if we rosette shuffle three or more piles with some simple structure?



Certainly, the earlier solitaire principle extends in the obvious way:
  • If k piles of cards, running 1-n, representing k "suits," are rosette shuffled together, and the cards in the resulting packet are dealt one at a time into k piles separated by suit, then the original piles will be reformed, in reverse order.

Canonical Indecencies Pix

Now we highlight something Karl Fulves pointed out in his hard-to-find book Riffle Shuffle Set-Ups (1968), which saw distribution only in magic circles. The rosette shuffle wasn't on his radar screen, of course, he was thinking in the context of riffle shuffling multiple piles, say, two at a time, until he had a single packet again. Even for the case of two piles, this fact has languished in obscurity for decades.
  • If k piles of cards, running 1-n, representing k "suits," are rosette shuffled together, and the cards in the resulting packet are peeled off k at a time, then if the jth set matches in value, they have value j.
In other words, if we rosette the four suits of a standard deck together, each having started in the order Ace to King, and we find that the third, seventh, and eleventh quadlets pulled off the top all match across the board, then they must consist of the 3s, 7s, and Jacks, respectively.

In practice, this is better performed with the suits arranged in some less obvious but memorized order. For instance, suppose we use the starting arrangement 3, 5, 10, Ace, 9, Jack, 2, 8, 7, Queen, 6, 4, King, in each suit. (This is much favored by John H. Conway, and is based on the mnemonic "The Five Tenacious Boys Nicely Joke To Hated Servant Girls Sick For Absent Kings"—we've omitted Jokers.) Have an audience member twirl the four face-down suit piles and mush them together, then turn away and request that cards be peeled off four at a time and inspected. If any such quadlet matches, you are informed. If the fifth and eighth quadlets match, say, "Coincidences I can explain." Confidently announce that they are the Jacks and 8s, respectively.

Incidentally, Fulves also has something to say about the values in any situation where the jth set of k cards contains of one of each suit (with none repeated).

Arrange Wall Modish

A year ago—and a full year after we issued the Call For A New Shuffle Principle (Need Rot Sextet?)—Ron Graham graciously responded to repeated prodding by coming up with the following key breakthrough, shared here with his kind permission.
  • Arrange a packet in cyclic order 0, 1, 2, 0, 1, 2, .... Now split into three piles that have as their top cards, 0, 0, and 1. In other words, the cards in the three piles are in the order 0, 1, 2, 0, 1, 2, ..., 0, 1, 2, 0, 1, 2, ... and 1, 2, 0, 1, 2, 0, ... . Rosette shuffle them together, so that in the result, the relative order of the three piles is preserved. Start removing sets of three consecutive cards at a time. Then none of these three-card sets will have all values the same.
That's not to say that three cards of the same type can't end up together, one coming from each pile, but they won't all be in any one of the triplets 1-3, 4-6, 7-10, and so on; they'd have to straddle two such triplets. More generally, Graham offered the following, which we think of as a kind of Non-Alliance Principle:
  • Start with a packet arranged cyclically as 0, 1, ..., , s-1, 0, 1, ..., s-1, and then break it into s piles, and rosette shuffle those together. If we now remove sets of s cards at a time from the top, and the top card of the original ith pile is denoted by ai, then assuming the sum of the ai is not 0 (mod s), we can be sure that none of the sets of s cards will have all values the same.
For s = 2, this is equivalent to something we have known for a long time. It says that if we break an alternating packet into two piles whose top cards don't match and then rosette shuffle, we can be sure that the cards in positions 1-2 won't match either, and likewise neither will those in positions 3-4, 5-6, and so on. This is the basic Gilbreath principle once more: the careful splitting suggested here is a quick alternative to the usual dealing out of cards to form the two piles (a shortcut which only works for alternating packets).

For s = 3, start with a packet cycling Clubs, Hearts, and Diamonds, and split it into three piles that have as their top cards Clubs, Clubs, and Hearts. Rosette shuffle, and pull cards off the top three at a time. No such triplet will consist of three cards of the same suit. The same conclusion also holds whenever the top cards of the three piles account for exactly two of the three suits in play. The principle is not saying anything when the top cards of the three piles are all the same, or account for one of each suit; but perhaps those cases yield to a different kind of analysis.

More details—and a preliminary magic application—can be found in Chapter 8 of Mathematical Card Magic: Fifty-Two New Effects (AK Peters/CRC Press, 2013).

"Limit Plus Peel" is an anagram of "Multiple Piles," "Treeless Shutoff" is an anagram of "Rosette Shuffles," "Sheaf Bullfighters" is an anagram of "Gilbreath Shuffles," "Canonical Indecencies Pix" is an anagram of "Coincidences I Can Explain," and "Arrange Wall Modish" is an anagram of "Ronald Lewis Graham."

Thursday, June 27, 2013

Subtler Bracelets and Dissociative Disorders

Things to Come

Card Colm has appeared here more or less every two months since October 2004, with more than 52 columns now in the bag. As we approach the completion of its ninth year, we're also getting closer to North America's premier summer mathematics celebration, MAA MathFest.

This year it's in Hartford, CT, and at the Recreational Mathematics: New Problems and New Solutions session there on Thursday, August 1, there's a talk on "Fitch Cheney's Five Card Trick for Four or Three Cards"—which is appropriate, as Cheney spent much of his professional life in the department of mathematics at the University of Hartford. The four-card version has been published twice by the MAA, here. The three-card take on this was developed on the way to MathFest 2012 in Madison last August, and was performed live there a few days later at the end of an MAA minicourse on mathematical card magic. The Hartford presentation will mark its debut with explanation. (It's scheduled to appear in Math Horizons in the first half of 2014.)

MathFest also sees the appearance of the 380-page full color Mathematical Card Magic: Fifty-Two New Effects (A K Peters), along with two book signing opportunities in the exhibtion hall (Thursday and Friday at 3pm). This volume actually contains more than 52 effects, along with an equal number of new mathemagical principles—but they are not in a natural one-to-one correspondence. Despite the coincindence of their also having been just as many Card Colms over the years, those aren't aligned with the effects in the book either. Yes, there is overlap—about three-quarters of the material?—but the book is organized differently, and is almost a grave of diamonds. It's also written for a more general audience and mostly eschews technical mathematical language.

Subtler Bracelets

In the June 2008 Card Colm Sum-Rich Circulants we continued a thread on bracelet beads started the previous year. Specifically, we focused on the g4g8 bracelet obtained by joining the ends of

[ 8     5    4    1    7    6    3    2 ].

Here's a good card incarnation:

 
 
Counting out 1, 2, ..., 8, reveals a "suitable" geometric pattern; classic cycling CHaSeD order is used. Moreover, this card display can be viewed as a capital omega (Ω), which brings to mind the word "alphabetical"—and amazingly, Eight, Five, Four, One, Seven, Six, Three, Two are indeed in that easy-to-remember order.

Here's the magic: plant these cards in order on the top of a deck and maintain them there throughout some fair-seeming shuffling, before dealing them face down in a circle. Have three adjacent cards peeked at and remembered by different spectators, while you turn away, and have those values summed. Upon being told this total you name all three selected cards. The reason is that this bracelet is sum-rich for triples: the eight possible sums of three adjacent card values are distinct. In fact, we get the numbers 17, 10, 12, 14, 16, 11, 13, 15, which are the eight consecutive numbers 10, 11, 12, ..., 17 in a special order.

This array first saw the light of day at the G4G8 conference in Atlanta in March 2008. Four years later, at the G4G10 conference, mathematician Steve Butler unveiled what we call the g4g10 bracelet, obtained by joining the ends of

[ 1     3    4     5    9    10    6    7    8    2 ].


Not only is this sum-rich for three adjacent beads, it's easily checked that it's also sum-rich for two adjacent beads. (The latter property doesn't hold for the g4g8 bracelet [8 5 4 1 7 6 3 2], as its double sums are 13, 9, 5, 8, 13, 9, 5, and 10.)

But wait, there's more: Butler's g4g10 bracelet is magical in a new and unanticipated way. The possible sums for adjacent triples and doubles are not only as large as they could be, as sets, they also have no overlap, being the sets {8, 12, 18, 24, 25, 23, 21, 17, 11, 6} and {4, 7, 9, 14, 19, 16, 13, 15, 10, 3}, respectively. Hence, in a card implementation as above, with 10 specific cards used and their suits memorized, you can deal these face down in a circle before turning away and asking that any two or three spectators select adjacent cards and reveal the value total to you. Without even knowing how many people were involved, you can reveal all. Pretty impressive, eh? Thanks to Steve Butler for sharing his wonderful discovery and allowing us to pass it on.

Dissociative Disorders

In the February 2008 Card Colm Additional Certainties, we broke rank with ordered beads on bracelets, abandoned the adjacency assumption, and considered sets such as {1, 2, 3, 5, 8, 13}, {1, 3, 4, 7, 11}, and {3, 4, 6, 8, 12}, which have the the property that if any two numbers from any one of them are added, then you can deduce what the numbers are from the total. In most cases it also works for three numbers, but it in general you'll also need to know how many values are being summed. For instance, if you are told that (Lucas) numbers from the second set sum to 8, but you don't know whether two or three were involved, then you're in trouble, as it could be 1 + 7 or 1 + 3 + 4. (In the June 2009 Card Colm Two Summer Difference Certainties, we extended these ideas to a wider class of sets, but the same ambiguity remained.)

It's natural to ask if something like Butler's g4g10 bracelet exists in the set context, for card values. Let's go all the way and seek sets of k numbers in the range 1-13 with the property that all 2k-1 nonempty subsets have distinct sums. Trivial examples are {1, 2, 4, 8} (powers of 2) and {1, 3, 9} (powers of 3), and the more interesting {1, 3, 6, 13}, in which each value is 1 more than twice the previous one. There are many examples of size 4; find some more.

Now find one of size 5. How many such examples are there? Are there more if we relax the demands and only ask that the 2-sums and 3-sums be distinct (and all different from one another)? Can we find larger sets if we allow the use of negative numbers too (represented by Red cards, as opposed to Blacks for positive ones)?

The upshot is that once suits are also decided upon, five cards can be planted at the top of a deck—maintained there throughout some shuffling—then dealt face down in a circle, before you turn away and ask that any number of cards be peeked at and remembered. Once the sum is announced, you can figure out just how many numbers are involved, and then name all of the selected cards.

The existence of such sets of numbers—they are known in the business as dissociated sets—was brought to our attention earlier this month by Neil Calkin of Clemson University. More details can be found in the Coda of Mathematical Card Magic: Fifty-Two New Effects (A K Peters), to be published August 2013.

"Subtler" is an anagram of "Butler's" and "a grave of diamonds" is an anagram of "devoid of anagrams."