MATT: OK, so I’m going to

do a card trick based on the number 27. And this is my all-time favorite

maths card trick. And I’m going to show it for

you today, and I’m going to explain it. I found this trick in an old

1950’s math book written by Martin Gardner. And for me it is the maths

card trick with the most beautiful maths behind it

out of all of them. And because it is a math card

trick, it does involve a lot of long tedious counting. But bear with us here. So this involves 27 cards, so

I’m going to take 27 off. And this is a genuine count. One, two, three, four, five,

six, seven, eight, nine, 10. 27 is actually one of my

favorite numbers– One, two, three, four, five,

six, seven, eight, nine, 10– because it’s a cubed number. One, two, three, four,

five, six, seven. OK, that’s 27 cards. And this works with any 27

cards, and none of this trick is slight-of-hand. None of it is YouTube magic

where I’m using something sneaky, or a sneaky edit. And I’ll explain the trick

afterwards, so it’s OK. But this is how works– You get 27 cards, you

shuffle them up. I’m actually going to

get Brady to both film and be the volunteer. So I’ll flick through, do you

want to tap which one you want, which one of these? OK that one there. Do you want to show you

the camera that card? Don’t let me see

it, obviously. And do you want to put it back

in wherever you want? Thank you. Now all he needs to do is just

remember what that card was, and believe me, people in the

comments will mention afterwards if you don’t. Brady what’s your favorite

number from 1 to 27, if you had to pick a number? BRADY: 10. MATT: 10, any particular

reason why 10? BRADY: I just like

how it looks. MATT: You like it? OK. Are you looking for your

card by the way? What I want you to do is have

a look, and see if you can spot which pile your

card goes into. And people may have seen

this trick done before. It’s a variation, in fact, it’s

a generalization on a 21 card trick. Which pile is it in? BRADY: It’s in that pile. MATT: In the middle

pile there? OK, I’m going to pick

them up from the viewer’s right to left. And what people tend to do is

they do this tedious counting out each time. And what I’m actually

doing is last time I memorized all the cards. And so I when you told me which

pile, I had narrowed it down to nine possible

cards it could be. If I do it again, because of the

way I’m dealing it out, if you tell me which pile it’s in

this time, I will narrow it down to one of three

possible cards. Which pile is it in this time? BRADY: This time it is

in the middle pile. MATT: The middle one again,

there we are. OK purely coincidence, I’ll

pick them up again. And then we’ll do it one last

time again dividing by 3, and this is why 27 is 3 cubed. If you say which one it’s in I

will know, having memorized all the cards, exactly one in

one, or I will know precisely which card it is. And that’s just the pure

information of this trick. Which one’s it in? BRADY: That one. MATT: That one over there. Cool, OK. So now to be fair all

of that wasn’t true. Well the numbers were true,

and the number of cards it could’ve been going from 27 to

nine, to three, to one, that is completely accurate. I wasn’t bothering to memorize

them though, I was doing something else slightly

different. What was your card? You can tell me now. BRADY: It was the

king of hearts. MATT: King of hearts, and what

was your favorite number? BRADY: 10. MATT: OK. Watch this. Here we go. Ready? One, two, three, four, five,

six, seven, eight, nine, 10. King of hearts. So this trick, you can put the

card– even though you don’t know what it is– as long as

they tell you which pile it’s in, you can put it anywhere

in that deck. So if you say any number, after

three lots of dealing it out, I can put the card

into that position. And that is my all-time

favorite maths based card trick. Do you want to know

how it works? BRADY: Yes please. MATT: This is brilliant. OK, so can I have some of

your famous brown paper? OK, excellent. Now let’s look at why

this trick works. Now you’re going to have

to bear with me here. I’m going to set up a

slightly unusual way to look at the cards. Because when you get the 27

cards, the very last step– if we go from the end

of the trick– I pick them up into three

piles of nine cards. From now on I’m going to call

the top one the 0th pile, and then the first pile, and

the second pile. And there’s a reason for that

in a moment, but just bear with me while I set

up some notation. So when the cards go back

together there are nine cards in the top pile one, two, three,

four, five, six, seven, eight, nine. So that was why I called

the 0th pile on top. Then there was one, two, three,

four, five, six, seven, eight, nine in the first pile. And the bottom one– one, two,

three, four, five, six, seven, eight, nine, that was

the second pile. And as it turns out your one

was the king of hearts. That ended up being the

10th card down. Because you said at the very

beginning your favorite number is 10, and your king of

hearts ended up there. And so now when you think about

it these top three from the final pile– because this is

the very last top, middle, and bottom pile– that top one came from the

previous top pile. That was the previous 0th pile,

that was the previous middle pile, that was the

previous bottom pile. That was the previous

top, middle, bottom. Top, middle, bottom. And so actually if you

watch it you can see how that happens. Because I’ve picked them up

from the second time. I’ve got the top, the middle,

and the bottom packets. Each are nine cards, I’ve

put them together. I deal out the next three piles,

and the first three come from that top

pack of nine. And then the next three come

from that top pack of nine, and then the next three from

the same top pack of nine. So that’s why over here the

top three come from the previous top 0th pile. The next three of each one come

from the middle pile. So that’s the first three off

the middle, next three off the middle, next three

off the middle. And I’ve got nine left, that was

the previous bottom pile. That’s why now I get three from

the bottom, three from the bottom, three

from the bottom. So they end up going

down like that. And if you get some cards and

you start playing around with this, within the final ordering

it turns out from the very, very first time you put

them together this is the top, the middle, the bottom. The top, the middle,

the bottom. The top, the middle,

the bottom. And don’t lose too much sleep

over exactly why this happens. If you get a pack of cards

and deal it, you’ll start to see why. And what you end up here is this

is the ordering from the first time we dealt

the cards out. That’s the ordering from the

second time we dealt the cards out, and that’s the ordering

from the third time we dealt the cards out. And to get it here at 10th,

I can see that to get this position here it’s

the 0th 0 first. Or top, top, middle. And so each time Brady pointed

to where his card was the first time I put that pile back

on top, the second time I put that pile back on top, The

third time I put that pile in the middle. The first time I put that

pile back on top. The second time I put that

pile back on top. The third time I put that

pile in the middle. In fact, Brady, do you want to

pick a different number? BRADY: So say I told you my

favorite number was 13, what would you have done? MATT: OK so 13, I need to put

12 cards on top of that, and 12 is one 9, one 3,

and no units. So I’m going to put

that on the top, the middle, the middle. 13 is, nine, 10, 11, 12, 13. Yeah see? 0, top, middle, middle. But the way I work it

out is I’m actually working it out in base-3. Because this whole trick uses

base-3 ternary numbers, which I think are absolutely

amazing. And the first time you put the

piles back together you’re doing the units column of

your base-3 number. The next time you put them back

together you doing 3’s column, and then the last time

you’re doing the 9’s column. And so when you give me your

number I work out that number in base-3, and then that

tells me how to put the piles back together. OK so now we’re going to redo

the very first trick I did in almost slow motion, in annotated

mode if you will. And so you had a look at one

card, and then I started dealing these. And then I talked to you about

your favorite number, and you said 10. You’re looking for the king of

hearts, and I’m thinking how am I going to get that

king of hearts? Well I don’t know

what card it is. How’m I going to get

whatever the card is to the 10th position? And 10, nine goes

into that once. And so I want to get

nine cards on top. So I actually have to put it in

the top, the top, and then the middle. So has the king of

hearts gone past? Where was it? BRADY: It was there. MATT: OK so I now know it has

to go top, top, middle. So when I pick them up from left

to right– these two I don’t care about– that can be

bottom, that can be middle. The king of hearts is in this

one, so it has to go on top. Which means it’s going to

be one of the first nine to get dealt out. And so it’s going to be either

the top card of the next piles, or the second card of

the next piles, which it happens to be, or

the third card. And then the rest we actually

don’t care about. Because those other two piles

I know it wasn’t in those. These are just padding to get it

into the correct position. So now which one was it in? The middle one? OK so again it’s top,

top, middle. So it has to go top again. And if you watch, when I pick

them up I still pick them up in the same order. But I put them together

in a different order. So that goes on top, and then

I’ll get this last one, and I’ll just shove it underneath. So now I know it’s on top. In fact I know it’s in the top

three of the top pile. So when I go down this time

it has to be the top card, there it is. And then the rest go on top, and

then the last time it has to go in the middle. And so you can see what’s

going to happen now. Because if it goes in the middle

it’s going to get nine cards put on top of it. It’s going to be the top card in

the middle pile, it’s going to be the 10th card. So it was in this one? Well how about that? Pick that one up first, pick

that one up and put it underneath. So it was the middle one, put

that one underneath like that, and so now it has to

be the 10th card. One, two, three, four, five,

six, seven, eight, nine, boom. So in fact one way you can

think about it is I like drawing a time versus

card height diagram. So the first time you do

it– this is the first time you deal out– you’ve got the bottom pack,

you’ve got the middle pack, and you’ve got the

top pack when you put them back together. And the reason I use 0, one, and

two is actual units column in ternary. The second time you’ve got the

bottom pack, you’ve got the middle pack, you’ve got the top

pack, and again that’s 0, one, and two. And that’s the second

time you deal. And then the third time you

deal, again you’ve got the bottom, the middle pack,

and the top, and that’s 0, one, and two. So there are the three

packs when you put them back together. And in fact this is your

units column, or that your 1’s column. That there’s your 3’s

column, and that there’s your 9’s column. So if you want to put 15 on top,

to get 15 you’re going to need two 3’s, one

9, and no units. So it’s going to go top,

bottom, middle. To put 15 cards on top. And it’ll end up being

the 16th card. BRADY: If someone at home wants

to do this trick do they have to be pretty

good at maths? MATT: You have two options. You can either be pretty good

at maths, or you can spend a lot of your free time practicing

until your brain gets used to doing this. Which to be fair, are both

exactly the same thing. Maths is all about practicing

something, and developing a new way of thinking for your

brain to get used to it. So either option, learn maths,

of learn card tricks. You’re ending up with the same

skill set to be honest. BRADY: You said at the start

this was your favorite trick to some extent. MATT: It is. BRADY: There are

lots of tricks. What is it about that one

that resonates with you? MATT: People know the 21 card

trick, where you put it back in the middle each time, and

then it ends up being the middle card. And so people kind of

know that, but they don’t know why it works. Whereas this one you know why it

works, and then you can do so much more with it. And there’s a huge difference in

math– indeed in anything– between just memorizing the

steps so you know how to do it, versus knowing why

those steps get you where you want to be. And so this utilizes the

advantage of knowing why the steps are doing something,

and then you can tweak it as you go. So instead of always putting it

in the middle you can put it anywhere you want, because

you understand how it works. Because you’re putting three

piles back together three times there are 27 possible

arrangements of putting it back across the trick,

which correspond to all 27 possible positions. In fact you can do this trick

with a lot more cards if you really want to. It’s the number of piles to the

power of how many times you deal the cards out. If you get 10 billion cards,

which is a lot of cards, and you deal them out into 10 piles

10 times, you can put any of those 10 billion cards

into any position just through 10 deals. Although admittedly you are

dealing a million cards into each pile, so it does take

a very long time. In fact in Martin Gardner’s book

Magic, Maths, and Mystery he describes that if you want

to do the 10 billion card version his recommendation is

to be very, very careful as you’re doing the 10 piles

of 10 each time. Because if you make a mistake

very few audiences will sit through that trick for

a second time.

But what if my favorite number is >27? Say, 28.

Actually, there is slight of hand done when you pick up the stacks I the way you are picking them up.

Could someone show the math behind why the 21 card trick works? I wrote out the numbers for the position of the card and found it ends up in the 10th 11th or 12th position, but I'm not seeing why mathematically.

This is a brilliant enhancement to the famous 21 card trick. I have always been intrigued as to why the 21 card trick worked. Your insight was very helpful.

6:47 lol ๐

@10:47 the column headings should be 3^0 3^1 3^2 surely ?

It annoys me that base 2 is binary and base 3 is ternary, not trinary.

You are the legends27

Hey Matt, I really don't get how to make 27 into your bases of 9-3-1. Can I get a hand please?

but what if their favourite number is more than twenty-seven?!

Maths is not about practice.. By practice, you develop a habit which without regular practice, you may forget how it worked in the first place.

So to do this trick you have to be a genius?

I presented this card trick to my class when I was 11 and I immediately became a permanent nerd. Thanks Numberphile ๐๐ฝ

It won't work for me :/

Edit: Nevermind, I mistook a stack of 27 with a stack of 18.

facepalmi wonder if, in the context of card tricks, anyone has ever answered "no" to "you wanna see how it works?"

Help! I seem to always pull the card in the nth+1 position!

Works beautifully. Easy to learn. Baffling to the sucker… er, I mean, the viewer.

Just wanted to point out (as was noted below by Sonja Quan) that this trick works equally as well with 64 cards. You have to convert the chosen number (number of cards from the top), minus 1, to base 4 using 1, 4, 16 instead of 1, 3, 9, and number the positions in the deck 0 to 3, top to bottom, and deal 4 piles each time (3 times), Otherwise it works the same way. This can be extended similarly to any deck of N-cubed different cards. Other generalizations are possible, if you don't mind dealing LOTS of cards.

So can this be done with binary, but with 8 cards?

Nice riffle skills!!

When he said the first pile was the 0th pile, I immediately knew it had something to do with base 3.

You can also add the digits together and what group of three the sum is in determines the position, so 1 2 and 3 are the top 3, 4 5 and 6 are the middle 3, and 7 8 and 9 are the bottom 3. Then you find the final position by which group of nine the chosen number itself is in: 1-9, 10-18, or 19-27. For instance, if 25 the chosen number, 2+5 is 7, and 7 is the top number of the bottom 3, and 25 is in the bottom 9, so in the order is top bottom bottom

?

Even if you know the trick its still magical! It's not a slight of hands but a slight of brains trick. Very impressive. Hello from the future past.

this trick also works with 21 cards also

To make the trick even better, I make a premonition of the card on the final turn. I write downย the card and its position, namely the favourite number chosen by the amazed party. It's easy to do.ย To locate the card on the turn simply count from either 0,9 or 18 until you reach the favourite number. Eg. to reach 25, count 7 turns of 3 from 18. To reach 14, count 5 turns from 9. Just memorize these 3 cards and when your guest choses the final pile, continue to place it as normal. You now know the card and can prognosticate it by writing it down before the big reveal. You can even do it without seeing the cards on the first two turns. Have pulled it off, to much bemusement.ย Many thanks for the inspiration for it Matt.

this is beautiful

Oh yea!!! The 21 Card trick. Don't know how that works though. lolol. But this 27 card trick is pretty cool.

Thanks Matt. Your video helped me get a gf

THAT WAS SO AWESOME

Where's the Extra footage?

"Very few audiences would sit through that trick a second time."

That was obviously a tongue-in-cheek joke by Gardner, perhaps to end the article. Nobody could sit through it

onetime. Assume you could deal two cards per second. You deal 10 billion cards 10 times, so that's 100 billion deals. That would take 50 billion seconds, or 1584 years.Not only that, but each pile of a billion cards would be over 180 miles high.

Parker looks a little hungover in this one.

I love that you can do this trick with pretty much any number. As long it a multiplication of any other numbers it's is possible to do this one. My favourite is probably doing it with 25 cards, many are confused because I have to do the ordering only twice, whileas they kinda understand the 27 card trick. It's also fun to do it with 24 cards, but I haven't fully grasped that one yet, but it works ๐

A little trivia 2million seconds is about 3 months so yeah I agree with Matt :'3

guys, it' s simple. pick the number, subtract 1 to it, make modulo 3 number from 000 to 222. read from right to left :0 means top, 1 middle, 2 under.

remember to subtract 1 to the starting number or you will get mad because the card appears always of 1 position later to what expected!!!

Tbh his riffle shuffle satisfies me a lot coz he's not using a table (im a sleight of hand magician)

the first 9 end in top the second nine in the middle and the third nine at the bottom

your count to 28

I've tried this several times & keep ending up with the card 1 after the number the person selects. Confirmed that my conversion to base-3 is right… any ideas of what I'm doing wrong?

This is why probability is a famous detective algorithm.

How is this done with base 2 if possible?

RADIX SORT BASE 3

What if favorite number is above 27. Do you make up something to make it 27 or smaller?

You can make this trick even more impressive my using all 52 cards and the two jokers and asking the person to pick a number 1-54. To start with you split the pack into two piles of 27, and ask what pile their card is in. If they choose a number 27 or under, you can discard the pile they didnโt pick and to the trick as normal. If they pick a number 28 or over, you have to put the other pile to one side, do the trick with the number they picked minus 27, then add the other 27 cards back to the pack at the end. In fact, this way, you can just ask the other person to think of a card rather than pick on, giving the illusion of reading minds.

Thanks, British Jim Carrey.

Thanks for the video its really amazing

I can't get this to work. Every single time, the correct card is in the n+1 position.

+Numberphile Could you provide the links to the recommended viewing shown at the end of this video in such a way that mobile viewers can follow them? Annotations don't show up when viewing from the mobile app, so if you could either add them to the description, put them in a pinned comment, or use some of those boxes built specifically for linking to other videos in place of the annotations in the video itself, that would be great, thanks.

This can actually be done with any number to any power (so long as you have enough cards). The amount of cards you need would be A^B where 'A' is the number of equal piles and 'B' is the number of times you sort the piles. And also, the number chosen by the participant can be larger than the amount of cards used

+Numberphile I feel like there must be some parallel here with a some kind of sorting algorithm, can we get a Computerphile crossover?

What if someone says their favourite number is greater than 27?

i do not understand it, and therefore, it makes me angry.

I learnt a variation to this trick, but you know their card by memorising the bottom card in the deck and stacking them in such a way that their card is underneath the card you memorised. You then know their card and make a stack with how many letters it takes to spell their card. Then stack the rest of the cards however you want. Get them to tell you their card and then ask them to spell their card out whilst putting the stack you made down and then the bottom card should be the card they chose

I tried this on my friends today, with the added bonus that I did actually tell them what their card was before turning it over at the end. The way I did it was I took their chosen number (17) mod 9 = 8, and from that figured out that their card will be the 8th one dealt to its pile on the last go. So I memorized the 8th card dealt to each of 3 piles, then told them what their card was when they pointed to their pile. So in the case of 10, his card will be the first one dealt to its pile on the last go. Go ahead, verify that it's true

how can I apply this to quantum computers ?

๐ tried this with my friend ๐ he told me 666 ๐ had to stop for a little while to do more maths ๐ fk… , now im about n^n card trick

My favorite number is

28.

Hear, O Hear, ye heroes of ordinary numbness!

There are no zeroes in ordinal numbers. Unlike

3^0, 3^1, 3^2, & 3^3

Somebody please tell me where I can buy that brown paper!

3:33

hella confusing

Matt Parker doesn't say "Bear with me" nearly as much as he used to, lol

Ternary system

We also played this card trick, but we didn't choose any particular number of cards like 27 in this case. We just selected some odd number of cards and same procedure was followed as you explained in this video with one exception. That is, every time we were keeping that pile of card in the middle of other two pile of cards. And finally at the end, guessed card exactly falls middle of the total number of cards.

Emmanuel Macron's math magic school

sure

loved this

Bro that hairline

Someone should make a machine to do the ten billion card trick.

done as the same with the 21 trick/ 3 piles, 21 cards, and the chosen card always ends in the 11th spot after three passes

Well I can guess what card they're picking

i still don't get it, everytime that I try it, i dont know where to put the pile he picked, on the ist and 2nd shuffle, the chosen pile with his chosen card, I put it on the top pile until the last shuffle, i always put his pile on the middle and ended up being a shame

Best part of the trick is when you explain it as you are doing it.

Its actually really simple, all I do is memorizing all the cards so I can work out where it is, and your audience thinks you are rainman ๐

Memorising the steps VS knowing why the steps get you where you want to be… that's a very well articulated way of saying what I've been saying all my life (math's got no need for memorisation)

"27 is a cute number"– Matt Parker

That did not work on my dad both times

king of red cookie shape thingy

Great math! But it is also possible to use base 2 and 36 cards, base 3 and 27 cards, base 4 and 16 cards, base 5 and 25 cards, base 6 and 36 cards, base 7 and 49 cards (my favourite!). A great video by Matt! ๐

it happens to be the king that committed suicide. K โฅ๏ธ

Just noticed the Parker cut in 7:44

A magician once showed me a deck of cards and told me to pick a card so I grabbed the whole deck of cards off him and put them in my pocket. They're my cards now!

The first time I went to practice the trick the card I pulled was the King of Hearts ๐

I was literally in awe for this was exactly the card trick we used to play when we were in elementary…can't even remember who taught us this trick lol..glad i stumbled upon it again for i totally forgot how to do it again haha

Mathematicians are quite a gambler, aren't they?

Beware… WE R MATHS!!!

Nah I wanna make someone go โwoahโ not study math

Lost my as he started using a sharpie on paper I can not stand scratchy sounds ๐คฎ

That shuffle though

For 15 as favourite card it should be bottom middle and middle. 2+3+9. BTW thanks for the knowledge share. It can be generalized for anything.

You lost me at MATH…….

you need to go to Penn & Teller to show this trick of

I decided to repurpose this trick with 16 cards, four rounds of two piles, to teach children binary. I think you could make another video like this, it's a quicker trick and more curriculum friendly…

6:47 GORGON INCOMING !!!!!!!!!!!!!

This channel should be called number

pileWould this work with 64 cards and doing it four times?

I want to try this!

This trick work's in any multiple of 3

Studying? Naaw.

Watching science video? YEAH!

damnnnnnnn