I don't want to be embarassed

A Mathematician was tasked to do a magic show in front of a group of elderly in an elderly home. Using his mathematical knowledge, he made a magic trick on the spot but was stuck at the last step, can you help him? The magic trick is as follows:

  1. Get a member of the audience to pick a card from the deck and with only the audience knowing the value of the card, place the card at the bottom of the pile.

  2. Take the top half of the deck (26 cards) and place them at the bottom of the card.

  3. Take the 26 cards in the middle and place them on top of the pile.

  4. Remove the bottom 26 cards from the deck.

  5. Once again, take 14 cards from the centre of the deck out and remove the other cards.

  6. For the last time, we take 6 cards from the middle and remove everything else.

  7. He then places all removed cards on top of the current deck in the order they were removed.

  8. Pull out the n t h n^{th} card from the top and show it to the audiences.

The question is, what is n n ?

Definition of terms used

  • n n cards from the middle - We take the number of cards into the deck to be 5. if n = 3 n=3 , if means the we take the 2nd, 3rd and 4th card.

  • The order they were removed - Assuming we have 7 cards and we remove the middle 3 cards(3rd, 4th, 5th) and then remove the middle 2 cards(2nd and 6th), we will then put the cards in order meaning that we first place the 3rd card, followed by the 4th, then the 5th, then the 2nd and lastly the 6th.

Image credit: Wikipedia Wuprisha


The answer is 49.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

I used a spreadsheet to solve the problem; actually any 4- or 5-column table will do. Let:

  • m m = the number of cards of the main deck after each step
  • n n = the position of the chosen card from the top of the deck
  • r r = the number of cards removed

The m m , n n and r r of each step are given below:

  • Step 1: m=52, n=52, r=0 # Chosen card at the bottom of the deck: p=52
  • Step 2: m=52, n=26, r=0 # Top half goes to bottom: n=52-26
  • Step 3: m=53, n=13, r=0 # Middle half to top: n=26/2
  • Step 4: m=26, n=13, r=26 # Bottom half removed: m=52-26
  • Step 5: m=14, n= 7, r=12 # Middle 14 remains; n=14/2, r=26-14=12
  • Step 6: m=6, n=3 8, r=0 # Middle 6 remains: n=6/3, r=14-6=8
  • Step 7.1: m=32, n=29, r=0 # 26 go on top: m=6+26, n=3+26
  • Step 7.2 : m=44, n=41, r=0 # 12 go on top: m=32+12, n=29+12
  • Step 7.3 : m=52, n=49, r=0 # 28 go on top: m=44+8, n=41+8
  • Step 8: m=52, n=49, r=0 # Therefore, n = 49

The answer is therefore, the 4 9 t h \boxed{49^{th}} card.

I did it mentally but question seems to be incomplete since in the 8th step he doesnot mention the n(th) card is same as the one chosen by the audience..

balaram tej - 6 years, 11 months ago

I did it mentally too. The spread sheet just kept track of my thoughts.

Chew-Seong Cheong - 6 years, 11 months ago

i did it mentally

Ashwin Upadhyay - 6 years, 11 months ago

Can anyone please tell me how do i implement this with programming???

Saurab Thakur - 6 years, 11 months ago

Log in to reply

Well actually Saurabh, as you must be knowing that programming is all about mathematics and logic, therefore this question was just to check one's mind compatibility or efficiency for programming. A question in Computer Science may or may not need a well written computer program. Thats what I think, so I just wanted to share the idea with you.

Sanidhya Srivastava - 6 years, 6 months ago

Balaram, it did mention at the start that: "...he made a magic trick on the spot but was stuck at the last step, can you help him?" I understood it.

Chew-Seong Cheong - 6 years, 11 months ago

i use 2 variables

  1. a a : number of cards over the chosen one

  2. b b : number of cards below the chosen one

to maintain position

Afrizal Fikri - 6 years, 10 months ago

yaa same....if a person saw the droped card and put it after 26. then magician watch the card 26. and remove all from down. when he swip the cards the position of the card will be same after 26. if u watch card 26 then next will be dropped card.

Pradeep Sheoran - 6 years, 10 months ago

I chose 48 and it was just a mistake from top it would be 49

Siddharth Khandelwal - 6 years, 10 months ago

As Balaram said, The question is incomplete. 'n' is not told to be the same as the card picked up at first. Otherwise would have been a simple calc.

Ranganath Govardhanam - 6 years, 10 months ago

miscalculated at step 7...

Muhammad Hussain - 6 years ago

All the steps can be reduced to only 2 types of moves :

  • remove(u,v) : remove cards in range [ u , v ) [u,v)
  • insert(L,x) : insert a pile of cards L L at the back of the x x -th card. In case of placing it on top, x = 0 x = 0 .

Implementing in Python it would look something like this :

1
2
3
4
5
def remove(u,v):
    return deck[0:u] + deck[v:]

def insert(L,x):
    return deck[0:x+1] + L + deck[x+1:] 

But yeah, mentally do the calculations or using a pen and paper is most likely to be faster...

Christopher Boo - 5 years ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...