arxiv: v2 [math.co] 15 Oct 2018

Similar documents
Roberto s Notes on Infinite Series Chapter 1: Series Section 2. Infinite series

Logarithms APPENDIX IV. 265 Appendix

Permutation Enumeration

x y z HD(x, y) + HD(y, z) HD(x, z)

THE LUCAS TRIANGLE RECOUNTED. Arthur T. Benjamin Dept. of Mathematics, Harvey Mudd College, Claremont, CA Introduction

Ch 9 Sequences, Series, and Probability

Counting on r-fibonacci Numbers

Grade 6 Math Review Unit 3(Chapter 1) Answer Key

A New Space-Repetition Code Based on One Bit Feedback Compared to Alamouti Space-Time Code

CS 201: Adversary arguments. This handout presents two lower bounds for selection problems using adversary arguments ëknu73,

lecture notes September 2, Sequential Choice

13 Legislative Bargaining

Unit 5: Estimating with Confidence

Shuffling Cards. D.J.W. Telkamp. Utrecht University Mathematics Bachelor s Thesis. Supervised by Dr. K. Dajani

Combinatorics. Chapter Permutations. Reading questions. Counting Problems. Counting Technique: The Product Rule

POWERS OF 3RD ORDER MAGIC SQUARES

PROJECT #2 GENERIC ROBOT SIMULATOR

BOUNDS FOR OUT DEGREE EQUITABLE DOMINATION NUMBERS IN GRAPHS

On Parity based Divide and Conquer Recursive Functions

}, how many different strings of length n 1 exist? }, how many different strings of length n 2 exist that contain at least one a 1

7. Counting Measure. Definitions and Basic Properties

x 1 + x x n n = x 1 x 2 + x x n n = x 2 x 3 + x x n n = x 3 x 5 + x x n = x n

1. How many possible ways are there to form five-letter words using only the letters A H? How many such words consist of five distinct letters?

Procedia - Social and Behavioral Sciences 128 ( 2014 ) EPC-TKS 2013

Fingerprint Classification Based on Directional Image Constructed Using Wavelet Transform Domains

sible number of wavelengths. The wave~~ngt~ ~ ~ ~ c ~ n b~dwidth is set low eno~gh to interfax One of the most im

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 12

8. Combinatorial Structures

CS3203 #5. 6/9/04 Janak J Parekh

APPLICATION NOTE UNDERSTANDING EFFECTIVE BITS

PRACTICAL FILTER DESIGN & IMPLEMENTATION LAB

Application of Improved Genetic Algorithm to Two-side Assembly Line Balancing

PERMUTATIONS AND COMBINATIONS

On the Number of Permutations on n Objects with. greatest cycle length

HOW BAD RECEIVER COORDINATES CAN AFFECT GPS TIMING

202 Chapter 9 n Go Bot. Hint

15 min/ Fall in New England

Intermediate Information Structures

COLLEGE ALGEBRA LECTURES Copyrights and Author: Kevin Pinegar

X-Bar and S-Squared Charts

AMC AMS AMR ACS ACR ASR MSR MCR MCS CRS

General Model :Algorithms in the Real World. Applications. Block Codes

Extra Practice 1. Name Date. Lesson 1.1: Patterns in Division

PERMUTATIONS AND COMBINATIONS

Laboratory Exercise 3: Dynamic System Response Laboratory Handout AME 250: Fundamentals of Measurements and Data Analysis

COMBINATORICS 2. Recall, in the previous lesson, we looked at Taxicabs machines, which always took the shortest path home

CHAPTER 5 A NEAR-LOSSLESS RUN-LENGTH CODER

5 Quick Steps to Social Media Marketing

A generalization of Eulerian numbers via rook placements

H2 Mathematics Pure Mathematics Section A Comprehensive Checklist of Concepts and Skills by Mr Wee Wen Shih. Visit: wenshih.wordpress.

Shuffling. Shahrzad Haddadan. March 7, 2013

A study on the efficient compression algorithm of the voice/data integrated multiplexer

2. There are n letter and n addressed envelopes. The probability that all the letters are not kept in the right envelope, is. (c)

A SELECTIVE POINTER FORWARDING STRATEGY FOR LOCATION TRACKING IN PERSONAL COMMUNICATION SYSTEMS

Name Class. Date Section. Test Form A Chapter Chapter 9 Infinite Series. 1 n 1 2 n 3n 1, n 1, 2, 3, Find the fourth term of the sequence

Density Slicing Reference Manual

ON THE FUNDAMENTAL RELATIONSHIP BETWEEN THE ACHIEVABLE CAPACITY AND DELAY IN MOBILE WIRELESS NETWORKS

Department of Electrical and Computer Engineering, Cornell University. ECE 3150: Microelectronics. Spring Due on April 26, 2018 at 7:00 PM

Mathematical Explorations of Card Tricks

COS 126 Atomic Theory of Matter

AMC AMS AMR ACS ACR ASR MSR MCR MCS CRS

Speak up Ask questions Find the facts Evaluate your choices Read the label and follow directions

H(X,Y) = H(X) + H(Y X)

Sapana P. Dubey. (Department of applied mathematics,piet, Nagpur,India) I. INTRODUCTION

VIII. Shell-Voicings

Technical Explanation for Counters

Counting III. Today we ll briefly review some facts you dervied in recitation on Friday and then turn to some applications of counting.

Summary of Random Variable Concepts April 19, 2000

Final exam PS 30 December 2009

A Math Learning Center publication adapted and arranged by. EUGENE MAIER and LARRY LINNEN

Radar emitter recognition method based on AdaBoost and decision tree Tang Xiaojing1, a, Chen Weigao1 and Zhu Weigang1 1

You Think You ve Got Problems? Marc Brodie Associate Professor of Mathematics, WJU

The Institute of Chartered Accountants of Sri Lanka

LX 422/722 Intermediate Syntax KEY (with notes) SPRING 2018 FINAL 38 points total; 22 for #1, 2 for #2, 7 for #3, 1 for #4, 6 for #5

SHORT-TERM TRAVEL TIME PREDICTION USING A NEURAL NETWORK

The Fundamental Capacity-Delay Tradeoff in Large Mobile Ad Hoc Networks

A Novel Three Value Logic for Computing Purposes

EMCdownload. Acknowledgements. Fair use

Cooperative Spectrum Sensing in Cognitive Radio Networks

EECE 301 Signals & Systems Prof. Mark Fowler

3. Error Correcting Codes

Revision: June 10, E Main Suite D Pullman, WA (509) Voice and Fax

Chapter (6) Discrete Probability Distributions Examples

Hybrid BIST Optimization for Core-based Systems with Test Pattern Broadcasting

AC : USING ELLIPTIC INTEGRALS AND FUNCTIONS TO STUDY LARGE-AMPLITUDE OSCILLATIONS OF A PENDULUM

Open Two Radio Switching Protocol (OTRSP)

Cross-Layer Performance of a Distributed Real-Time MAC Protocol Supporting Variable Bit Rate Multiclass Services in WPANs

PERMUTATION AND COMBINATION

Western Number Theory Problems, 17 & 19 Dec 2016

MDM 4U MATH OF DATA MANAGEMENT FINAL EXAMINATION

Test Time Minimization for Hybrid BIST with Test Pattern Broadcasting

We often find the probability of an event by counting the number of elements in a simple sample space.

Lecture 4: Frequency Reuse Concepts

IV054 IV054 IV054 IV054 LITERATURE INTRODUCTION HISTORY OF CRYPTOGRAPHY

(2) The MOSFET. Review of. Learning Outcome. (Metal-Oxide-Semiconductor Field Effect Transistor) 2.0) Field Effect Transistor (FET)

Circular waveguides. Introduction. Table of Contents

A New Design of Log-Periodic Dipole Array (LPDA) Antenna

Alignment in linear space

Compression Programs. Compression Outline. Multimedia. Lossless vs. Lossy. Encoding/Decoding. Analysis of Algorithms

BOTTLENECK BRANCH MARKING FOR NOISE CONSOLIDATION

Transcription:

THE 21 CARD TRICK AND IT GENERALIZATION DIBYAJYOTI DEB arxiv:1809.04072v2 [math.co] 15 Oct 2018 Abstract. The 21 card trick is well kow. It was recetly show i a episode of the popular YouTube chael Numberphile. I that trick, the audiece is asked to remember a card, ad through a series of steps, the magicia is able to fid the card. I this article, we look ito the mathematics behid the trick, ad look at a complete geeralizatio of the trick. e show that this trick ca be performed with ay umber of cards. 1. Itroductio to the 21 card trick The21 card trick(21ct) isavery popular cardtrick. It was alsorecetly show ia episode of the popular YouTube chael Numberphile. e first explai how this trick is performed i a series of steps. For the purpose of this demostratio, we will assume that a magicia(heceforth, Magi), is showig this trick to his fried ad audiece(heceforth, Audy). (1) Audy radomly chooses 21 cards from a deck of cards. He remembers oe card from that set, shuffles the set of 21 cards ad hads it back to Magi. (2) Magi requests Audy to pay attetio as he puts the cards face up oe at a time adjacet to each other creatig 3 stacks of 7 cards each i the process. Magi asks Audy to tell him which stack cotais his card. (3) Magi the puts the stack that cotaied Audy s card betwee the two other stacks, ad the repeats tep (2) two more times. (4) Magi ow puts the cards i the table oe at a time, ad stops at the 11th card which turs out to be Audy s card. Note that this trick ca be made more magical with some extra activities, which we will ot discuss as they do t cotribute aythig to the mai problem. Our curret goal is to fid out why the 11th card o the deck happeed to be Audy s card. e will explore the mathematics behid this after we look at a detailed example of the trick. Oce Audy hads the shuffled deck of cards to Magi, we kow that Audy s card could be ay oe of the 21 cards i that deck. Let s umber the cards from top to bottom of the deck by 1,2,3,...,21. e shall use the term deck id to deote the positio of Audy s card i the deck. imilarly, we will use the term stack id to deote the positio of Audy s card i a stack from the top. 2010 Mathematics ubject Classificatio. 97A20. Key words ad phrases. Recreatioal mathematics, games. 1

2 DIBYAJYOTI DEB Defiitio 1.1. A iteratio is cosidered to be the process of splittig the cards of a deck ito stacks. Defiitio 1.2. The deck id of Audy s card after kpě 1q iteratios of splittig ito stacks, deoted by d k, is the positio of his card from the top, i a deck of distict cards. Defiitio 1.3. The stack id of Audy s card after kpě 1q iteratios of splittig ito stacks, deoted by s k, is the positio of his card from the top, i its idividual stack. Note that the iitial deck id of Audy s card before ay iteratios happe is deoted by d 0. e ow show a detailed example of the 21CT i actio. (1) Audy selects a radom collectio of 21 cards. The cards are: 4, 10, 3, 10, 10, 8, 6, 3, 10, 2, 5, 6, 2, 8, A, K, 9, 4, 9, K, J He remembers a card from this set. uppose it s 4. He the shuffles this deck agai ad hads it over to Magi. The shuffled deck looks like this: 8, 10, 9, 2, 3, 5, 4, 6, 6, 2, 10, 10, K, J, 9, 8, 3, A, 10, 4, K (d 0 20) Note that a iteratio has t happeed yet. Thus, s 0 is ot defied, ad d 0 20 (as 4 is the 20th card i the deck at the momet). (2) Now Magi does the first iteratio by puttig these cards face up oe at a time adjacet to each other creatig 3 stacks. The stacks the look like this: tack 1 tack 2 tack 3 8 10 9 2 3 5 4 6 6 2 10 10 K J 9 8 3 A 10 4 K Table 1. tacks after Iteratio 1 (s 1 7 as 4 is the 7th card i the secod stack) He the asks Audy which stack cotais his card. Audy replies by sayig that his card is i tack 2 ( 4 is i tack 2).

THE 21 CARD TRICK AND IT GENERALIZATION 3 (3) Magi the puts tack 2 i betwee tack 1 ad tack 3. The set of 21 cards ow look as follows from top to bottom: 8, 2, 4, 2, K, 8, 10, 10, 3, 6, 10, J, 3, 4, 9, 5, 6, 10, 9, A, K (d 1 14) Magi ow repeats tep (2) two more times. The stacks after iteratio 2 looks like this: tack 1 tack 2 tack 3 8 2 4 2 K 8 10 10 3 6 10 J 3 4 9 5 6 10 9 A K Table 2. tacks after Iteratio 2 (s 2 5) He the agai asks Audy which stack cotais his card. Audy replies by sayig that his card is i tack 2 agai ( 4 is i tack 2). Magi agai puts tack 2 i betwee tack 1 ad tack 3. The set of 21 cards ow look as follows from top to bottom: 8, 2, 10, 6, 3, 5, 9, 2, K, 10, 10, 4, 6, A, 4, 8, 3, J, 9, 10, K (d 2 12) Magi agai repeats the process of splittig the cards ito 3 stacks for the third ad fial time. The stacks after iteratio 3 look like this: tack 1 tack 2 tack 3 8 2 10 6 3 5 9 2 K 10 10 4 6 A 4 8 3 J 9 10 K Table 3. tacks after Iteratio 3 (s 3 4) Now for the fial time, Magi asks Audy about the stack that cotais his card. Audy replies by sayig that his card is i tack 3 ( 4 is i tack 3). Magi the

4 DIBYAJYOTI DEB puts tack 3 i betwee tack 1 ad tack 2. The set of 21 cards ow look as follows from top to bottom: 8, 6, 9, 10, 6, 8, 9, 10, 5, K, 4, 4, J, K, 2, 3, 2, 10, A, 3, 10 (d 3 11) (4) Magi ow puts each card from the top face dow o the table oe by oe, ad flips over the 11th card which turs out to be Audy s card, 4. 8, 6, 9, 10, 6, 8, 9, 10, 5, K, 4 Magi correctly fids out Audy s card, ad it leaves Audy startled. He woders what kid of voodoo did Magi apply i all of this. Little does he kow about the power of mathematics behid this trick. 2. The Mathematics behid the 21 card trick Most card tricks rely o mathematics. The 21CT is o exceptio. e ow look at the mathematics behid this trick. Before we look ito the steps of the 21CT agai, we would like to look at the defiitio of the ceilig ad floor fuctios, ad three lemmas that will be used extesively i this article. Defiitio 2.1. uppose x P R. The ceilig of x deoted by rxs is the smallest iteger greater tha or equal to x. I geeral, if rxs P Z, the 1 ă x ď. Defiitio 2.2. uppose x P R. The floor of x deoted by txu is the largest iteger less tha or equal to x. I geeral, if txu P Z, the ď x ă `1. I this case x x txu is called the fractioal part of x, ad is deoted by txu. Lemma 2.3. For x,y P R, if x ď y, the Proof. e divide this ito two cases. rxs ď rys Case 1 : (y ď rxs) As rxs 1 ă x ď rxs by defiitio, ad x ď y, therefore, rxs 1 ă y ď rxs. This implies that rys rxs, ad therefore, rxs ď rys. Case 2 : (y ą rxs). By defiitio, y ď rys. Therefore, we have rxs ă y ď rys. Hece, rxs ă rys. Combiig the two above case, we have the desired iequality. Lemma 2.4. For P Z ad x P R, r `xs ` rxs

Proof. uppose r `xs d. Thus, THE 21 CARD TRICK AND IT GENERALIZATION 5 d 1 ă `x ď d pd q 1 ăx ď d This implies, rxs d. Addig to both sides, we have ` rxs d which shows the desired result. Lemma 2.5. For,m P Z with m ą 0, ad x P R, ` rxs `x m m `x Proof. uppose d. Thus, m d 1 ă `x m ď d md m ă`x ď md md m ă x ď md As m,d, P Z, thus md m ad md are itegers. By defiitio of the ceilig fuctio, x ď rxs. Hece, md m ă rxs. O the other had, x,md P R. Hece, by Lemma 2.3, rxs ď rmd s md as md P Z. Thus, we have This implies, md m ă rxs ď md md m ă`rxs ď md md m m ` rxs ă m ď md m d 1 ă ` rxs m ď d ` rxs d, which proves the result. m Now we look back at the steps of the card trick agai. tep 1: Audy hads the shuffled deck to Magi. e deote the iitial deck id of Audy s card by d 0 as o iteratios of splittig ito stacks has bee doe yet. Therefore, 1 ď d 0 ď 21 tep 2: Magi ow puts the cards from the top, face up, o the table adjacet to each other, creatig 3 stacks of 7 cards each. Audy s card is i oe of the three stacks. e claim the followig.

6 DIBYAJYOTI DEB Claim 2.6. If s k deotes the stack id, ad d k deote the deck id of Audy s card after k iteratios, the, Q dk 1 s k for k ě 1 3 Proof. It is imperative for us to ote that a stack id for Audy s card is created after every iteratio. Hece, s k is defied oly whe ě 1. O the other had, a deck id for Audy s card is created whe the 21 cards are all i a sigle deck, which happes for the first time whe Audy hads over the shuffled deck to Magi. Thus, d k is defied for k ě 0. Also, ote that the kth iteratio which creates s k is performed usig the 21 card deck after the pk 1qth iteratio which creates d k 1. Hece the relatioship betwee s k ad d k 1. It is clear that the stack id of a card is the row umber of the card i the stack. Thus for k ě 1, the first row cosists of cards with d k 1 1,2,3. The secod row cosists of cards with d k 1 4,5,6 ad so o. This meas that the th row cosists of cards with d k 1 3 2,3 1,3. As s k. Thus, Therefore, 3s k 3 ăd k 1 ď 3s k s k 1 ă d k 1 ď s k 3 Q dk 1 s k. 3 As 1 ď d 0 ď 21, hece, 1 3 ď d 0 3 ď 7 Q d0 1 ď ď 7 pby Lemma 2.3q 3 1 ď s 1 ď 7 pby Claim 2.6q Now Magi asks Audy to tell him the stack that cotais his card. Audy respods by sayig that it s tack 2. tep 3: Magi the puts tack 2 i betwee the other two stacks ad creates a full deck of 21 cards. Note that there is a stack of 7 cards o top of tack 2 at the momet. The positio of Audy s card i tack 2 is curretly s 1. Hece, the ew deck id of Audy s card after the first iteratio is, ice 1 ď s 1 ď 7, therefore, d 1 7 `s 1 8 ď7 `s 1 ď 14 8 ď d 1 ď 14

THE 21 CARD TRICK AND IT GENERALIZATION 7 Now the secod iteratio is performed, ad the stack id s 2 is created, 8 ď d 1 ď 14 8 3 ď d 1 3 ď 14 3 Q d1 3 ď ď 5 pby Lemma 2.3q 3 3 ď s 2 ď 5 pby Claim 2.6q Note that Magi ow kows that the stack id of Audy s card is either 3, 4 or 5, but that is ot good eough, as he eeds to fid the exact card. He agai asks Audy to tell him the stack where his card belogs. Audy metios that it s tack 2, ad Magi puts tack 2 i betwee the other two stacks to create a deck of 21 cards. The positio of Audy s card i tack 2 is curretly s 2. Therefore, the ew deck id of Audy s card after the secod iteratio is, Now, 3 ď s 2 ď 5, therefore, d 2 7 `s 2 10 ď7 `s 2 ď 12 10 ď d 2 ď 12 Now the third iteratio is performed, ad the stack id s 3 is created, 10 ď d 2 ď 12 10 3 ď d 2 3 ď 12 3 Q d2 4 ď ď 4 pby Lemma 2.3q 3 4 ď s 3 ď 4 pby Claim 2.6q This meas s 3 4. Magi ca ow see the fiish lie. Magi has ow foud the exact stack id of Audy s card i a stack, but he does ot kow exactly which stack cotais Audy s card. He thus asks Audy oe fial time about the stack that cotais his card. Audy metios tack 3, ad Magi puts tack 3 i betwee the other two stacks. The positio of Audy s card i the middle stack is curretly s 3 4. Hece, the ew deck id of Audy s card after the third iteratio is, d 3 7 `s 3 11 tep 4: Magi ow kows that Audy s card is the 11th card from the top of the 21 card deck. He puts each of the card from the top o the table, face dow, util he flips over the 11th card to Audy s delight. 3. Geeralizatio of the 21 card trick Now that we have see how the 21CT works, ad the mathematics behid it, we ask ourselves whether the same trick ca be performed by Magi usig a radom set of, let s say C umber ofcards. Healso wats to fidout theumber of stacks he eeds to split his

8 DIBYAJYOTI DEB cards ito, where should he put the stack that cotais Audy s card, how may iteratios should he perform, ad lastly, the deck id of Audy s card after the fial iteratio. Let s help out Magi perform his trick. Before we proceed, we itroduce some otatios. Number of give cards = Cpą 0q P Z. Number of stacks to split ito = pą 0 ad ď Cq P Z. Number of stacks to put o top of the stack which cotais Audy s card = jpě 0 ad ă q P Z. Number of iteratios to be performed = kpą 0q P Z. Deck id of Audy s card after the fial iteratio = lpą 0q P Z. e have thus created a 4-tuple (C,,j,k) that provides iformatio about the magic trick. Defiitio 3.1. A magic trick (C,,j,k) is solvable, if there exists itegers k ad l such that the magic trick ca be performed with the give parameters i iteratios. I this case, we write pc,,j,kq l If such a k or l does ot exist the the magic trick caot be performed, ad we say that (C,,j,k) is ot solvable. The 21 card trick is represeted by (21, 3, 1, 3) ad is solvable ad p21,3,1,3q 11. Followig alog the lies of the 21CT, our mai assumptio here is that each stack cotais the same umber of cards. Thus, C. Thus, ď C. Before we proceed ay further, we first look at a geeralizatio of Claim 2.6 i the form of a theorem ad a additioal result. Theorem 3.2. uppose C cards are split ito stacks durig a iteratio. If s k deotes the stack id, ad d k deote the deck id of Audy s card after k iteratios, the, Q dk 1 s k for k ě 1 Proof. The proof of this theorem is very similar to the earlier proof of Claim 2.6. e kow that the stack id of a card is the row umber of the card i the stack. Thus for k ě 1, the first row cosists of cards with d k 1 1,2,3,...,. The secod row cosists of cards with d k 1 `1, `2,...,2, ad so o. This meas that the qth row cosists of cards with d k 1 pq 1q `1, pq 1q `2,..., pq 1q `. As q s k. Hece, ps k 1q ăd k 1 ď ps k 1q ` ps k 1q ăd k 1 ď s k Therefore, s k 1 ă d k 1 ď s k Q dk 1 s k.

Theorem 3.3. uppose k ě 1, the THE 21 CARD TRICK AND IT GENERALIZATION 9 d k C j `s k Proof. As C cards are beig split ito stacks, hece each stack cotais C cards. s k is the stack id of the desired card after k iteratios. j stacks are kept o top of the stack C that cotais the desired card. There are a total of j cards i these j stacks. Thus, the ew deck id after k iteratio is, d k C j `s k for k ě 1 Note that our goal is to fid a exact value for d k. This would tell us the deck id of the desired card which would successfully coclude the trick. Due to Theorem 3.3, we ow have a expressio for d k that we ca ivestigate further. This results i the ext theorem which will be used extesively i the ext sectio. Theorem 3.4. uppose C m ad k ě 1. The, $ 1 & mj k 1 `d 0 d k mj ` 1, for ą 1 % d 0, for 1 Proof. Case 1 : ( ą 1) e will use mathematical iductio o to prove this result. Q d0. For k 1, L.H.. = d 1 mj `s 1 from Theorem 3.3. Thus, d 1 mj ` 1 mj 0 `d 0 Q R.H.. = mj ` 1 d0 mj ` Now assume the result is true for some k t ě 1. Thus, 1 mj t 1 `d 0 d t mj ` 1 t. Hece, the result is true for k 1. Now, d t`1 mj `s t`1 mj ` Q mj Q dt mj ` mj ` t 1 1 1 t `d 0

10 DIBYAJYOTI DEB As mj ad are itegers, hece by Lemma 2.5, Q mj t 1 1 `d 1 0 mj mj ` mj ` t t 1 1 1 t `d 0 mjt ` mj t mj 1 t`1 `d 0 Now, mjt mj mj t`1 mj 1 mjt ` `d 0 `d 0 mj t `d 0 1 1 1 Therefore, t`1 t`1 1 mj pt`1q 1 `d 0 d t`1 mj ` 1 pt`1q ad thus the result is true for k t `1. Therefore, by iductio, the result is true for all k ě 1. Case 2 : ( 1) As 1, ad 0 ď j ă, hece j 0. By Theorem 3.3, d k s k for k ě 1 Now, accordig to Theorem 3.2, s k rd k 1 s d k 1 for k ě 1. Therefore, d k d k 1 for k ě 1 olvig this recurrece relatio, we get d k d 0. 4. Mai Result The 21CT ad the results that we have see so far pushes us to the more geeral questio. Geeral Questio Give itegers C,, ad j, does there exist a positive iteger k, such that the trick pc,,j,kq is solvable? I that case, what is pc,,j,kq? e aswer this questio usig a algorithm. e will the look at the proof of the results i our algorithm. (1) tart with give itegers C,,j. (2) Fid m C mj ad b (for ą 1). 1 (3) If C 1, the p1,1,0,kq is solvable for ay k ě 1. I this case, p1,1,0,kq 1. (4) If C ą 1 ad 1, the pc,1,0,kq is ot solvable for ay k ě 1. (5) If C, ą 1, the pc,,0,kq is solvable for ay iteger k ě l C. I this case, pc,,0,kq 1. t`1

THE 21 CARD TRICK AND IT GENERALIZATION 11 (6) If C, ą 1, the pc,, 1,kq is solvable for ay iteger k ą l pc 1q. I this case, pc,, 1,kq C. (7) If C, ą 1 ad 0 ă j ă 1, the pc,,j,kq is solvable if, ad oly if, p 1q mj. I this case, pc,,j,kq is solvable for ay iteger k ą l t, where t max! C b 1 tbu, b 1 tbu ) ad, pc,,j,kq mj ` tbu `1. The steps (3) - (7) of the above algorithm gives a complete aswer to the geeral questio posed at the begiig of this sectio. e will prove each step i the form of a theorem, culmiatig with proof of the all importat tep (7). Theorem 4.1. (tep (3)) If C 1, the p1,1,0,kq is solvable for ay k ě 1 with p1,1,0,kq 1. Proof. This is a trivial case as there is oly 1 card. As 0 ă ď C, therefore, 1. Also, as j ă, hece j 0. By Theorem 3.4, d k d 0. e kow that the iitial deck id d 0 of the desired card is betwee 1 ad C. Thus, 1 ď d 0 ď 1. Therefore, d k d 0 1. Thus p1,1,0,kq is solvable for ay k ě 1, with p1,1,0,kq 1. Theorem 4.2. (tep (4)) If C ą 1 ad 1, the pc,1,0,kq is ot solvable for ay k ě 1. Proof. By Theorem 3.4, d k d 0, as 1. But 1 ď d 0 ď C. Thus, 1 ď d k ď C for k ě 1 As C ą 1, there is o specific value of d k that we ca fid for ay k. Thus, the trick pc,1,0,kq is ot solvable. Theorem 4.3. (tep (5)) If C, ą 1, the pc,,0,kq is solvable for ay iteger k ě l C. I this case, pc,,0,kq 1. Proof. From Theorem 3.4 with j 0, we have As 1 ď d 0 ď C, therefore, d k Q d0 1 ď d 0 ď C k Q k 1 Q d0 Q C ď ď As ą 1, therefore 0 ă 1 ă 1. Hece, k Q C (1) 1 ďd k ď

12 DIBYAJYOTI DEB Now, k ě l C ad C ą 1. This implies, ě C Therefore, 0 ă C ď 1 Q C 1. sig this result i iequality (1), we have 1 ď d k ď 1 Thus, d k 1. This shows that after k iteratios, we have a specific value for the the deck id d k, ad this value is the positio of the desired card which happes to be the first card i the deck. Hece, the trick pc,,0,kq is solvable for ay iteger k ě l C, ad pc,,0,kq 1. Theorem 4.4. (tep (6)) If C, ą 1, the pc,, 1,kq is solvable for ay iteger k ą l pc 1q. I this case, pc,, 1,kq C. Proof. Here j 1. Therefore, by Theorem 3.4, 1 mp 1q k 1 `d 0 d k mp 1q ` 1 mp 1q ` mp 1q ` mp q m ` d0 m As m P Z, therefore, by Lemma 2.4, d k mp 1q ` m ` d0 m d 0 m mp 1q `m` d 0 C m ` as C m. d 0 is the iitial deck id before ay iteratio. Hece 1 ď d 0 ď C. This implies, (2) 1 C ď d 0 C ď 0 1 C d 0 C ď ď 0 e are told that k ą l pc 1q, hece ą C 1. This implies, 1 C ą 1 1 C ą 1 ` d0

This alog with iequality which meas THE 21 CARD TRICK AND IT GENERALIZATION 13 1 C 0 ď d 0 C 0. Therefore, ď 0 from (2), implies that d 0 C ď 0 d k m C 1 C 0. Thus, This shows that after k iteratios, we have a specific value of the deck id d k, ad this value is the positio of the desired card from the top of the deck. Thus, the trick pc,, 1,kq is always solvable for k ą l pc 1q, ad pc,, 1,kq C. Theorem 4.5. (tep (7)) uppose m C ad b mj. If C, ą 1 ad 0 ă j ă 1, 1 the pc,,j,kq is solvable if, ad oly if, p 1q mj. I this case, pc,,j,kq is solvable! C b b 1 ) for ay iteger k ą l t, where t max, ad, pc,,j,kq mj `tbu`1. 1 tbu tbu Proof. Before we proceed further, we first verify that each of these logarithms are defied. As 0 ă j ă 1, hece, mj ă mp 1q bp 1q ă mp 1q b ă m as ą 1 b ă m C ą b as C m Also, whe the trick is solvable the b R Z. o, 0 ă tbu ă 1, hece 1 tbu ą 0. Thus C b C b 1 tbu ą 0, ad hece, l is defied. For the other logarithm, we kow that 1 tbu C ě, thus, C ą 1, ad sice 0 ă j ă 1, hece, Cj ą 1 Cj 1 ą 1 mj 1 ą 1 mj b ą 1 as 1 b b 1 b 1 As tbu ą 0, hece, ą 0, ad thus, l is defied. tbu tbu Now we come back to the mai proof.

14 DIBYAJYOTI DEB Part 1 e first show that if p 1q mj the pc,,j,kq is solvable. As p 1q mj, thus b R Z. Hece 0 ă tbu ă 1. From Theorem 3.4, we have, 1 bp 1q k 1 `d 0 d k mj ` 1 bp q mj ` mj ` As b tbu ` tbu ad tbu P Z, hece, by Lemma 2.4, d k mj ` tbu ` tbu ` d0 b As usual, 1 ď d 0 ď C. Thus, (3) (4) Hece, Now suppose t C b 1 tbu. Thus k ą l b ` d0 b ` d0 tbu ` 1 b ď tbu ` d0 b ď tbu ` C b tbu ` 1 b ď tbu ` d0 b ď tbu ` C b C b 1 tbu b 1 ě l. This implies, tbu ą C b ad b 1 ą 1 tbu tbu C b 1 b ă 1 tbu ad ą tbu tbu ` C b ă 1 ad tbu ` 1 b ą 0 e have already see that C ą b ad tbu ą 0. Thus, This implies, (5) 0 ă tbu ` C b ă 1 tbu ` C b 1 From iequality (3), we see that, tbu ` 1 b ď tbu ` C b ă 1

Thus, This agai implies, (6) THE 21 CARD TRICK AND IT GENERALIZATION 15 0 ă tbu ` 1 b ă 1 tbu ` 1 b 1 sig results from (5) ad (6) i iequality (4), we have 1 ď tbu ` d0 b ď 1 Therefore, tbu ` d0 b ad d k mj ` tbu `1. As there is a specific value of d k after k iteratios, thus pc,,j,kq is solvable i this case with pc,,j,kq mj ` tbu `1. b 1 b 1 C b Now suppose t tbu. Thus k ą l ě l. e follow the same tbu 1 tbu argumet as before to coclude that tbu ` d0 b 1 ad d k mj ` tbu ` 1. Agai, as there is a specific value of d k after k iteratios, thus pc,,j,kq is solvable i this case with pc,,j,kq mj ` tbu `1. Now we prove the other directio. Part 2 e have to prove that for C, ą 1 ad 0 ă j ă 1, if pc,,j,kq is solvable the p 1q mj. e will however prove the cotrapositive of this statemet as they are equivalet. Hece we will show that for C, ą 1 ad 0 ă j ă 1, if p 1q mj, the pc,,j,kq is ot solvable. As p 1q mj, thus b P Z. sig Theorem 3.4, 1 1 bp 1q k 1 `d 0 d k mj ` 1 mj ` bp q ` d0 mj ` b ` d0 b mj `b` d 0 b as b P Z

16 DIBYAJYOTI DEB e kow that 1 ď d 0 ď C. Thus, (7) (8) Hece, e have already see that C ą b. Thus, 1 b ď d 0 b ď C b 1 b d 0 b C b ď ď C b ą 0 C b ą 0 imilarly, we have also see that b ą 1. Hece, 1 b ă 0 1 b ď 0 C b 1 b As P t1,2,3,...u ad P t0, 1, 2,...u, hece from iequality (8), k d 0 b d 0 b does ot yield ay specific iteger for ay k. Thus, d k mj `b` is also ot a specific iteger for ay k. Therefore, pc,,j,kq is ot solvable. Note that from theorems 4.1, 4.3, 4.4, 4.5, we see that the value of a solvable trick pc,,j,kqdoesotdepedok. Hece, twosolvabletricks pc 1, 1,j 1,k 1 qad pc 2, 2,j 2,k 2 q will be cosidered the same trick if C 1 C 2, 1 2, ad j 1 j 2. 5. Other Iterestig Results Now that we have a complete mathematical uderstadig of the trick, we ask ourselves some iterestig questios. (1) Give a umber of cards C, how how may solvable magic tricks are there? (2) How does our algorithm solve the 21CT? (3) Assumig C, ą 1, what choices of C ad will guaratee that pc,,j,kq is solvable for all 0 ď j ď 1 ad a appropriate k. (4) Assumig C, ą 1, what choices of C ad will guaratee that pc,,j,kq is ot solvable for ay 0 ă j ă 1. e aswer these questios i the form of a theorem ad several corollaries.

THE 21 CARD TRICK AND IT GENERALIZATION 17 Theorem 5.1. For a give umber of cards C ě 1, the umber of solvable magic tricks p, is give by $ & 1, C 1 ř p C `1 gcd, 1 C ą 1, ą 1 % ą1 C Proof. Case 1 (C 1): If C 1, the 1, therefore, there is oly oe trick p1,1,0,kq which is solvable for ay k ą 0 by Theorem 4.1. Thus p 1. Case 2 (C ą 1):If 1, thethereisagaiolyoetrick pc,1,0,kqwhichisotsolvable for ay k ą 0 by Theorem 4.2. Therefore, p 0. Now suppose C ą 1 ad ą 1. e choose a fixed that is a divisor of C. e will first fid out how may tricks are ot solvable. By Theorem 4.5, if 0 ă j ă 1, the pc,,j,kq is ot solvable for ay k, if p 1q mj where m C. As 0 ă j ă 1, thus p 1q j. The possible values of mj are m,2m,3m,..., p 2qm. There are 2 such values. e thus eed to fid out which multiples ofmarealsomultiples of 1iorderforthetrick pc,,j,kqtobeotsolvable. The aswer happes to be the multiples of lcmpm, 1q from the defiitio of the least commo multiple. However, we eed to fid out how may multiples of lcmpm, 1q exist mp 1q i the set tm,2m,3m,...,p 2qmu. This is give by 1. e subtract lcmpm, 1q 1 as mp 1q is oe such multiple that does ot belog i the set. From elemetary mp 1q umber theory [1], we see that gcdpm, 1q. Thus, the umber of tricks lcmpm, 1q pc,,j,kq that are ot solvable for 0 ă j ă 1 is gcdpm, 1q 1. o, the umber of tricksthataresolvablefor0 ă j ă 1is p 2q pgcdpm, 1q 1q 1 gcdpm, 1q. Now for j 0 ad j 1 we have see that pc,,j,kq is solvable by Theorems 4.3 ad 4.4. These add 2 more solvable tricks. Hece, the total umber of solvable tricks pc,,j,kq for a fixed, ad a appropriate k is 1 gcdpm, 1q `2 `1 gcd C, 1 As ą 1 cycles through the divisors of C, we ca see the total umber of solvable tricks for a particular C to be p ÿ ą1 C `1 gcd Corollary 5.2. The 21CT, p21,3,1,3q is solvable. C, 1 Proof. e use tep (7) of our algorithm as C, ą 1 ad 0 ă j ă 2. Here m 21{3 7, mj 7 1 7, ad 1 2. As, 2 7, hece p21,3,1,kq is solvable for ay iteger

18 DIBYAJYOTI DEB k ą l t. e ow fid t. I order to fid t, we eed to kow b ad tbu. b mj 1 7 2. Hece, tbu 3, ad tbu 1 2. # 7 7 + 21 3 3 1 t max 2 1 1, 2 maxt21,19u 21. As k ą l 1 3 21 2.771, hece, 2 2 k 3. Thus, the21ct, p21,3,1,3qissolvable. Moreover, d 3 mj`tbu`1 7`3`1 11. Therefore, p21,3,1,3q 11. Corollary 5.3. uppose C, ą 1. If gcd p 1q, C 1, the pc,,j,kq is solvable for all 0 ď j ď 1 ad a appropriate k. Proof. By Theorem 5.1, the umber of solvable tricks for a specific, is equal to `1 C, 1 C, 1 gcd. As gcd 1, hece theumber ofsolvable tricks is `1 1 which are for all the possible values of j 0,1,2,..., 1. Hece, pc,,j,kq is solvable for all 0 ď j ď 1 ad a appropriate k. Corollary 5.4. uppose C, ą 1. If C p 1q, the pc,,j,kq is ot solvable for ay 0 ă j ă 1. To fid Proof. sig previous otatio, m C, we see that C p 1q is the same as m 1. Thus, 1 mj for all 0 ă j ă 1. Hece, by Theorem 4.5, pc,,j,kq is ot solvable. 6. Coclusio e have foud a complete aswer to the geeral questio posed at the start of ectio 4 (Mai Result). The algorithm preseted i that sectio shows us a way of determiig if a trick is solvable while startig with C cards, split ito stacks, with j stacks goig o top of the stack with the desired card after every iteratio. I brief, here is a summary of questios that are aswered i this paper. If Magi is haded C pą 1q cards ad is asked to split them ito pą 1q stacks, without ay specific j, the he ca perform the trick pc,,0,kq or pc,, 1,kq for appropriate k s as they are solvable due to Theorem 4.3, ad 4.4 respectively. If Magi is haded C pą 1q cards ad is asked to split them ito pą 1q stacks, with a specific 0 ă j ă 1, the he ca use Theorem 4.5 to determie if the trick pc,,j,kq is solvable for ay k ad proceed. I additio, we also foud the total umber of solvable tricks for a give C i Theorem 5.1. Fially, usig our algorithm we list some solvable tricks other tha the 21CT below, that ca be performed by ayoe with a deck of cards to impress their frieds.

THE 21 CARD TRICK AND IT GENERALIZATION 19 p20,4,2,3q 14 p28,4,2,3q 19 p36,6,4,3q 29 p21,7,5,2q 18 p30,5,3,3q 23 p36,9,3,2q 14 p24,6,4,3q 20 p32,4,2,3q 22 p39,3,1,4q 20 p25,5,3,3q 19 p33,3,1,4q 17 p40,4,2,3q 27 p27,3,1,4q 14 p35,5,3,3q 27 p40,8,5,2q 29 [1] D. Burto, Elemetary Number Theory. Table 4. List of 15 solvable tricks Refereces Departmet of Mathematics, Orego Istitute of Techology, Klamath Falls, OR, A E-mail address: dibyajyoti.deb@oit.edu