*Welcome to techInterview, a site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!*

This is a card trick without the trick. there is no sleight of hand, no tricks up my sleeve, no magic whatsoever. it’s all done with logic, yet it will amaze most people.

Joel and i are working together as a team to do the trick. Babak will be the culprit.

i ask babak to pick 5 cards out of a deck. he can pick any five cards, he can shuffle the deck 7 times, it really doesn’t matter. he honestly picks out 5 cards that i cannot see. he hands the five cards to me (joel can’t see any of this). i look at the cards and i pick 1 card out and give it back to babak. i then arrange the other four cards in a special way, and give those 4 cards all face down, and in a neat pile, to joel. joel looks at the 4 cards i gave him, and says out loud which card babak is holding (suit and number).

i did not convey any information to joel other than the way i ordered the 4 cards, (all face down, aligned in line with one another) so how did i encode babak’s card using that method?

hint 1: card trick without the trick

hint 2: card trick without the trick

### Solution

hint 1 talks about how there are guaranteed to be at least 2 cards with the same suit in a series of five cards. i use this to signal to joel the suit of the card. i have to make a decision though between which of the two cards to give back to babak. which one do i pick?

hint 2 talks about how if i use one of the cards to signal the suit, that only leaves me with 3 cards. i can only arrange 3 cards in six permutations. how do i signal a number between 2 and 13 using only six permutations?

simple really. consider that the series of cards is a cycle.

2 3 4 5 6 7 8 9 10 J Q K A 2 3 4 5 6 7 8 9 10 J Q K A 2 ... etc

i take the two cards of the same suit (if there are more than two of the same suit, then i choose any two, it won’t affect the solution) and i pass babak the one that is further to the right in the cycle. if i do it correctly, the one further to the right will be no more than 6 places away than the one to the left. (it just depends on how you think about the cycle).

for example. say we had the 2 and the 9 of hearts. if you look at it as the 2 to the left and the 9 to the right, it is seven cards away. but if you look as the 9 to the left and the 2 to the right in the cycle, the 2 is only 6 cards away.

then i just come up with a system of the permutations that signals how many places to the right to count to find the correct card

one such system could be:

sort the 3 non-same suit cards first by number then by suit (diamonds, spades, hearts, clubs) to give a unique sort for every card.

label the cards as A, B, and C.

place the cards in the following order to signal how many places away babak’s card is:

A B C - 1

A C B - 2

B A C - 3

B C A - 4

C A B - 5

C B A - 6

then put the suit card on top and give the pile to joel.

example:

babak picks out the following five cards:

3C 7D 10S QH AD

the 7 of diamonds (7D) and the ace of diamonds (AD) are the two suit cards. i recognize that AD is going to be the left card and 7D the right (because the other way they are 7 spaces apart). i give babak back the 7D. i sort the other cards, 3C 10S QH. i have to signal 6 places to the right (7D - AD = 6). so i place them in C B A format: QH 10S 3C. i then place the AD on top and pass to joel.

joel pulls off the first card and sees that it is the AD. (he knows babak’s card is a diamond). he looks at the next 3 cards and realizes their ordering is C B A. signalling 6, he counts 6 spots from the ace. (2 3 4 5 6 7). then he says “7 of diamonds” and the crowd is amazed.

another **sneakier card trick** (with the trick) works as follows.

babak picks one card out of the deck and shows it to me. he doesn’t tell joel and i don’t speak. after seeing the card, i sneakily use my one hand to signal both the number and suit of the card. i use my four fingers (not the thumb) as bits signalling a binary number. if they are extended it means 1, if i don’t extend them it means 0. the pinky is the least significant. so to signal 7 i would extend all fingers except my index finger. the suit is signalled by four positions of the thumb (hidden, adjacent to the hand, slightly ajar, fully extended). i can use this method to tell joel the card without saying anything (and making any noticeable motions). with some practice it can really amaze people (at least it worked with my family).