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).