Obviously I brought along my Numberphile playing cards. Other playing cards are available, but these are the best ones! Okay so, just, well you know, we know our Numberphile playing cards. There's me... (Brady: Oh, what?! You pulled yourself out?) Of course I pulled it out, I'm always at the top of the pot, Brady! There is you, of course. So they can watch. They're just here to watch. I'm also going to let Matt watch because Matt is the, is the sort of "king of Numberphile card tricks," right? Okay. So I've just taken nine cards. The first, all the clubs, basically all the numbered clubs. Here's the challenge to you, Brady. I want you to put them in any order you like. (Brady: I'm not even going to pay attention. Let's go...that'll do me.) Yeah, okay. So if we read off what number that's gonna be: nine hundred and forty-five million, one hundred and thirty-six thousand, eight hundred and seventy-two. Do you notice something about that number? Is there anything that you notice about it? (Brady: It's even!) It is even, yeah. Do you think it's - so it's obviously not prime, then. Do you think this number's in the 9 times table? (Brady: Probably not, doesn't feel like it is.) Yeah, I mean, 1 in 9 numbers is in the 9 times table, right? So you might think it's unlikely. Should we have a bet? Okay, I'll bet you a pint, all right? (Brady: A pint, all right.) So you're saying it's not. I'm gonna say it is. Okay. So should we check? Okay. Let's check. So we put the number in, divide it by 9, see if we get a whole number... Oh, yes we do! Okay. Now, do you want to go again? Do you wanna try again? You can even take a number out if you want. (Brady:Any number I want?)
- You take out any number, all right? (All right, well let's take out, let's take out-)
- Do double or quits, right? (Let's take out the top number.) Okay, you're taking out the top number, so you've been left with this number. Okay. Do you reckon this is-? Do you want to move them around a bit? (Yeah, let's swap the five and the four, there we go.) You sure? Are you done? (Yeah, I'm done.) Okay. Do you think this is in the 9 times table? (Yes, I do.)
- You do, now, do you?! Okay, well, you might have won your bet now. Okay, let's check it. Divided by, let's see, 9 equals...Yes, it is. Well done. Well, you removed the 9 which made it a lot easier for me. If you'd removed, say, let's put this back, if you removed the 5, my next step was going to be, "Oh, you know, it's only fair I get to move one out, take one out as well." And I was going to take out the 4. We'll come back to why that worked later. Let's try another trick, okay? A slightly different one. So you've got the first four cards. Now, multiples of 3 are quite common, right? I mean, 1 in 3 numbers is a multiple of 3, right? I'm giving you four cards. You can put them in any order, just make me a multiple of 3. You can just try it, you can guess! (Brady: Well, all right. Let's go with...) (2, 1...) (...4, 3?) You don't sound confident, Brady. I like to see a bit of confidence. Okay, so 2143, we're gonna divide it by 3. Oh dear. Do you need some help? I could help you. Yeah, I'm just gonna put one card in for you, all right? This one. And now you can put it wherever you like. (Oh, let's put it in the middle.)
- Okay, let's put it in the middle, right, you want to put it right in the middle? You sure? You don't wanna put it over here? (No, I'm gonna put in the middle.)
Okay. All right. Well, let's turn this card over. Okay. Now, let's see if this helps the situation. Let's try it now. 21543. Let's try dividing that by 3. It worked! Okay! So, what is going on Brady? What is going on? Well, these little tricks, they're kind of inspired by, actually, my own incompetence. Because in our last video that you and I did together, which was about Belphegor's prime, if you remember? We asked the following question: we asked, "Is this number--" We had a 1, and then lots of 0s, and then a 616, and then another bunch of 0s, and then a 1. We asked if this number was a prime number or not. We said it, you know, "If we put in enough 0s, can we find a prime number?" And I ran a little computer code and got up to a hundred thousand 0s and didn't find any, I don't know if you remember this. "And I searched up to n = 100,000, and no prime numbers." And, of course, our super smart Numberphile viewers immediately saw that this was never going to be a prime number. And the reason was, well if you calculate the sum of all the digits, so the cross sum of this object, then you'll get 1 plus lots of 0s, 6 plus 1 plus 6, bunch of 0s again, plus 1 - and that totals 15. Now, 15 is divisible by 3. If that number, if the cross sum, is divisible by 3, then it guarantees that the original number is divisible by 3. (Brady: So you were running this code, checking every number, when you were never-) It was never gonna be there. It was never gonna be there. So, waste of computer time and Brady time. I should have just been as smart as Numberphile viewers! (What did you think of that? Or was that like...?)
I just- To be honest, if I'm honest, I was trying loads of different things. Because I wanted something that might sort of look cool in the video. And I got so sort of hung up on all different things I was trying, I sort of lost sight of the beauty of maths. So, of course, this explains what went wrong with your attempt at the number earlier. You took the first four numbers. Whatever number combination you take these in, I mean these numbers 1, 2, 3, and 4 - they add up to 10. So whatever order I put them in the cross sum is always going to be 10. But 10 is not divisible by 3. So whatever number I create cannot be divisible by 3. And now I add the 5 and it doesn't matter where I put it, the cross sum is now guaranteed to be 15. Whatever number I create is guaranteed to be divisible by 3. Okay, if the cross sum is divisible by 3 the number is divisible by 3.
- (Brady: Okay.)
- It's also true for nines. If the cross sum is divisible by 9, the number is divisible by 9. And that comes back to this one: first nine numbers, what do they sum? They sum to 45, 45 is divisible by 9, so whatever combination of these numbers I take - whatever order I take - it's guaranteed to be divisible by 9. (Brady: This isn't true for other cross sums? Like if the cross sum is divisible by 4 it doesn't mean the number-)
- Nope. No, no.
- (It's just 3?)
- 3 and 9 it works for, okay? It works for 3 and 9, okay. There are other, other rules that you can apply to other numbers, and we'll get into that, but for this this cross sum rule, it works for 3s and 9s.
- (Brady: Let's see a proof then.)
- Ok, let's see the proof. Let's write down the kind of number that we might be interested in. Let's just write it down as follows. So the number N, let's just write it, it's gonna be an N plus 1 digit number, okay, which we might write like this. Okay, so we've got a0 in the ones, a1 in the tens, and so on. Let's actually write down what this number is, sort of algebraically. So what this means is that N is really 10 to the N times an, plus 10 to the n minus 1 times a n-1, plus 10 a1 plus a0. Okay? So that's what this number is. Okay any number in principle at this stage. Now let's write down the cross sum, okay. So the cross sum is easy to write down, let's call it T of N, okay, that's just going to be the sum of all these individual positions. So an plus a n-1 plus du du du, all the way up to a1 plus a0. Ok, now let's do that take away that. Do that we get N minus T of N. Okay let's see what we're gonna get. So in this position we'll get 10 to the N minus 1 an plus 10 to the N minus 1 minus 1 a n-1, you'll get similar things all along. Here you'll get 10 minus 1 a1 and then the a0s will cancel. Now look at what you've got. You've got - this is 9, right? The next one in the series would be 99. This one is going to be a whole bunch of 9s. This one's going to be a one more 9, it'll have another 9 there. So this is going to be all the 9s, all the 9s, they're all going to be 9s. So they're all divisible by 9. Okay, so I can pull out a factor of 9. So this is always going to be 9 times some whole number. If the cross sum is divisible by 9 this is divisible by 9, then this better be divisible by 9. And similarly if the cross sum is divisible by 3, this is definitely divisible by 3, then this number, the original number, must be divisible by 3. So that's the proof, dead simple right? Dead easy to prove. Okay?
- (Brady: Why does that only work with 9s and 3s?) Precisely because the fact that you take - the factor that you take out is 9, okay, that's why. So that you know basically you can only do it for 3s and 9s then. So there are a bunch of these rules, some some of which are easier than others. And we can go through them, right. So 1, okay, that's ea- pretty easy to check if something's divisible by 1. 2 is easy, it just has to be an even number. 3's we've done. What about 4s? Okay what's the divisibility rule for 4? Okay, I'm gonna write you down a multiple of 4: 145632. Viewers can check if that's a multiple of 4 directly. We know it is, how do we know it is? The way you do the 4 check is you just look at the last two digits, okay, and you ask yourself are the last two digits divisible by 4? If they are that's enough. So here it's 32, that's divisible by 4, I don't need to worry about the rest. And it's easy to see why because these are 100s, 1000s, 10 000s. 100 is divisible by 4, a thousand's divisible by 4 and so on. All the, all the higher powers of ten are divisible by 4 so the only thing you need to check are the last two. So 4s are easy as well, it's a really easy test. 5s? Pretty easy, does it end in 5 or 0? 6s? Well there you have to do the 2 test and the 3 test. Okay, so you check is it even and then you do your, your cross sum test for 3s. (Brady: And it has to pass both?)
- It has to pass both. Yes. 7s. We're gonna come back to 7s, 7s - 7 is a notoriously magical and mystical number right, and 7s are the hardest of these, you know, of these sort of lower numbers for doing the divisibility test so we'll come back to 7 later. 8, let's try 8s. Ok so here's an example, 1 7 5 2 4 6 4. So again viewers can check that this this is indeed a a multiple of 8 directly. How do we check in? Well, it's very similar to the 4 test, but it comes in an extra stage. Well, it depends how good you mental arithmetic is actually. Okay so what you do is - so whereas with 4s we checked the last two digits, with 8 we check the last three digits. Okay, so we look at this 464 and we ask is that guy divisible by 8? If that guy's divisible by 8, then this guy's guaranteed to be divisible by 8. Again, why does it work? It's a very similar reason to the, to the 4s, so basically because the thousands, the 10 thousands, and so on and all the higher powers of 10, are automatically divisible by 8 so you only need to look at the last three. But I dunno about you Brady but my mental arithmetic's not good enough to check if, straight away, whether that number is divisible by 8. But there is a test for checking very easily when you've, if you've got a three-digit number whether it's divisible by 8. Let's take this case 464. What we do is we take these two digits here, okay 46, and we multiply that by 2, and then we add the other digit. Okay, if you do that you get 96. Now my mental arithmetic is just about good enough to know that that is a multiple of 8, okay, so if this number is a multiple of 8 then this number is a multiple of 8 and by association so is this number. So it's a two-stage test. So let's just prove this three-digit test for the multiples of 8, it's again quite easy. So we just take N and the number that we're interested in, well let's write it as a hundred times a2 plus 10 times a1 plus a0. The test we're going to perform is, let's call it T(N), is basically we take you know, the first two digits, so that's like 10 a2 plus a1, okay, and we multiply that by 2. And then we add the other one which is a0. Now take these two away from one another and you get N minus T(N). What are you gonna get? You're gonna get 100 minus 20 a2s, that's 80 a2. You get 10 minus 2 a1s, that's 8 a1 and the a0s cancel. You can probably see it now, right? Basically if this number is divisible by 8, which is the thing that was the thing that was our test, so if the test number is divisible by 8 this is guaranteed to be divisible by 8, then that's gonna be divisible by 8. That's why it works. Should we carry on? (Brady: All right. What else you got?)
- Well we done 9s already, so 10s? I think, you know, most of us can work out 10s. Living, as we do, in our in our base-10 world. So let's do the test for 11s. Dead simple, really easy test, okay. So let's pick a number. This you can check if you use your calculator,t his is a multiple of 11. Okay, so let's do the test. Okay so the first thing you do when you do the 11s test is you have to reverse the number. Okay, so you reverse the order of the number, so you write it as nine, six, six, five two, 0, five. And now, you don't take the cross sum of this number you take the alternating cross sum. What do I mean by that? Well, that means I do nine minus six plus six minus five plus two minus zero plus five. Then I think it is, let's have a look, I think it's 11. Okay so again, the rule is if the number you end up with here is a multiple of 11 then the number you started out with is a multiple of 11. (Brady: So if it have been 22 or 33-)
- If we'd got 22, yeah, that would have guaranteed the original number was a multiple of 11.
- (Brady: Gosh, that's really obscure.)
- Yeah, we can prove it if you want? It's actually quite quite easy to prove, but there's another sort of slight sort of take on the card trick that you can do for this one. It needs you to be slightly quick with your, with your mental arithmetic. So basically you lay out a bunch of cards, I don't know, any order let's, let's not worry too much about what it is. Okay, and let's take five- a five digit number. Okay, so you want to start off with something that's not going to be a multiple of 11. Shall we just check whether this one is or isn't before we proceed? ...divided by 11, no, it's not. Good. Just laid our random number here okay, and now you're gonna show how clever you are by, you're just gonna say I'm gonna add one card and make it a multiple of 11. Okay. So how do you do that?
- (Brady: I can't do that thing in my head - reversing and alternating cross sums)
- Okay let's see if I can do it. Okay, so it's...well ok. It's a challenge mate! (Brady: That is what you have to do!) You have to do it, yes, you have to do it but you have to do it in your head. Okay, so I'm gonna... (Brady: Worst calculator ever.) Okay, right. Yes. I know what I need to add, okay. Right I need another card. Yeah. Okay so I need to uh, huh, okay, I think that should do it.
- (Brady: A 5 at the start?) Yeah, so if you've got much bett- if your mental arithmetic, is better than mine you'll do this in no time.
- (Brady: So you were reversing that number then alternating?) Yeah, so I was adding, I was, I was doing the cross sum - the alternating cross sum in reverse right? Five minus three plus one minus two plus four, I think is five. Okay, so I need to take off that. That would get me to zero which is definitely a multiple of 11 you see. (Brady: Ohh alright the zero, right) The goal is to get to multiple of 11. You can also start playing around putting numbers at the start. but it gets a bit more complicated. But all right, let's try it. Okay 5 4 2 1 3 5 divided by 11 Yay! It worked! Okay, so obviously you need to be pretty sharp with the mental arithmetic to do this one which, I'm afraid I'm not. 12s? 12s well 12s is just you build it from the 4s and 3s, okay, so it's the same as - you just you do the 4 test and then you do the the 3 test. So that's easy. (Brady: And that just has to pass both?)
- It has to pass both, yeah. We could go on, but let's come back to 7s. Okay, 'cause we skipped 7s which was a bit naughty. 7s are hard, 7s are notoriously hard! There is a reasonably simple one, but it also reminds me of a friend of mine, I've got a friend called Norrie. Norrie is a lot of things but he is not a mathematician but he has this this thing he can do where he, if he sees a number he can tell immediately whether it's a multiple of seven. And it's really strange he sort of like, he sort of sees the number in a cloud in his mind and then if he's sort of warmed towards it, if he feels like a friendship towards it, then that means it's a multiple of seven. This is totally real, just totally, he's not - as I said, he's not a mathematician. He did English at uni, but yeh! He has this rather unusual thing that he has.
- (Brady: How did you find out that he has this ability? How does it come up in conversation?) Oh Norrie likes to talk about himself a lot! So it was always going to come up at some point.
- (Brady: Do you test him? Do you get out a calculator?) He can do it! There's no messing about, he can totally do it. (Brady: To how big- like how big a digit?) Yeah, so he can go to about five digits and then he starts to feel physical effects apparently, at that point. (Brady: I should be making a video with Norrie!) Well the irony was, the irony was, when I told him I thought I'd mention this he, he decided that the whole video should be about him, this is typical Norrie. But I said the whole video is not going to be about Norrie, but maybe it is! (Brady: Will he let us have a picture of him to put on the screen right there?) Norrie will love to have a picture of himself on the screen. (Brady: That's Norrie there) Okay. So how do I do it? Okay, so we got a multiple of seven, let me write it down. If Norrie looked at that number he'd start to feel his friendship feelings of warmth and all that, right? Okay, so the 7s test, the simplest one I could find is the following. You take the blocks of three, okay? So this block of three here, 984, and then we do like an alternating sum again. So we now take the next block of three, which is this one, and we take it away. 976 And then we add, we keep going like this. The next block is going to be a 6, of course we stop here. Okay, if we had more we'd keep doing this in an, in an alternating way. Okay so now you actually calculate this thing, erm which is obviously pretty easy to do. So that is going to be, I think 14? So if the result is a multiple of seven that guarantees that the original number is a multiple of seven. (Brady: I imagine quite often we're going to get negative numbers on this, with this test?)
- That's fine, they, they can be negative numbers, they can be a multiple of seven. It's just a, a negative number times something. This was actually a really, a really simple example and it was pure luck that it turned out to be so simple. Normally, you're going to end up with a three-digit number here, right? So you're faced with the question of is that three-digit number a multiple of seven, which generally is not gonna be that easy. And so let's do another example, maybe quickly just to see how that can arise. Here I have another little number which happens to be a multiple of seven. So I do 123 minus 872 and I am gonna get, this it turns out to be minus 749. That's a bit hard isn't it Brady? That's beyond my mental arithmetic that's for sure. Okay, so we're going to now do another three, three digit test on for 7s.
- (Brady: Is that really - but I mean 749 actually is pretty easy...)
- Oh that's really easy, yeh! I just realised! See this is why I miss the Belphegor's Prime thing Brady. (Brady: Let's pretend that is a hard one) Okay, okay, but let's pretend it's hard but what would be the test that we'd do? Okay so you take your 7, we don't need to worry about the minus sign. So you take your 749, okay, so we take this number here, which is 74, and we take off twice this number here. Okay, so two times nine. Okay, that's 56. And then the issue is, is this a multiple of 7? Which of course it is. Okay, that would guarantee that this is, and by association this is. This, this test for three digits is quite straightforward to prove. Proving that these blocks of three works is, is not so easy. You can prove it, okay? (Brady: I hope you can prove it! Otherwise you shouldn't be using it!) You can prove it, and it relies on two facts, we're not going to do the proof. The first fact that you need to prove this, is that this number is basically 7 times 11 times 13. Okay, so actually what's important about it is that it's a multiple of seven. The other fact that you need to know is that, 999,999 is also a multiple of seven! And it's this multiple of seven. So this is a multiple of seven, this is a multiple of seven. These are the two facts you need to prove this sev- particular sevens test.
- (Brady: But it's quite an elaborate proof?)
- It's - yeah, it's, it's, it's, it's, yeah exactly. It's, it's, it's not, it's not a particularly entertaining proof. Notice by the way, it's got this number in here. Do you remember that number? (Brady: I do, isn't that the one where you can like cycle, cycles?)
- Yeah, yeah, yeah, we did we did a video on that number. In fact I think we even probably showed that result. I'm quite, it sort of pleased me that that reappeared. Okay. Okay, so there is - you can do one in all generality okay, erm, which - I don't know how exciting this is, but we can do it with an example. (Brady: What? A way to test if any number is divisible by anything?) Any number that ends in one, three, seven or nine. You know, you might need to use a few iterations of it to actually get get down to the to the bottom, but yeah, there is a general test. So let's let's do an example, okay, so I can illustrate the general test.
- (Brady: D'you want another piece of paper?) Erm yeah, why not. So let's try it for 23, okay. So the first thing that you have to do, so let's start with 23. (Brady: That's the number, the divisibility number?) Yeah, we're gonna look at, we want to ask things in the 23 times table. The number we're gonna test for is this number - which is in the 23 times table. So the test goes in various stages. First thing you've got to do is you've got to generate a new number from this guy. Okay, I'm gonna call it the divvy number. Okay?
- (Brady: From 23?)
- From 23 I'm going to generate 23's divvy number. So the first thing you have to do is you have to multiply this by something to make it end in 9, okay? So if you've got a number ending in 3, to make it end in a 9, you just multiply it by 3. Okay, so that will give us 69. So you've now got a number that ends in a 9. Okay, if you had - if your number ended in a 1 or a 7 or a 9, so it wasn't 23 it was 21, or 27 or 29, you would multiply by a different number to get it to end in a 9. Okay, it would still be one of 1, 3, 7 and 9 but you'd just choose something else. The goal is to get something that ends in a 9. Okay, once you've got something that ends in a 9, you then add 1. Okay, so that's easy, that gives us something that's a multiple of 10. It's guaranteed to be a multiple of 10. Okay, in our case it's 70. Now once you've got this multiple of 10 you just divide by 10. Okay, so let's divide this by 10 - we obviously get 7. Okay, this is our divvy number. So what's the test? Okay. So now we've got our divvy number, we've got our number that we're interested in looking at, and so the thing you have to do is you have to write this number in the form 10 t plus q. Now, if I do that that means that t is 103 and q is 5. Now, using your divvy number, what you do is you create - so let's call the divvy number m. Okay, you create a new number which is this thing. Okay, so let's calculate what this is. Okay, so m is 7, q is 5, and this is 103. That happens to be 138, which hopefully your mental arithmetic is good enough to check that - to see that, that is a multiple of 23. So if the number you end up with here is a multiple of the 23, then the number you were testing is a multiple of 23. So you can adapt this method to any number that ends in 1, 3, 7 or 9 and it will work. Ok, what it relies on is that the numbers constructed in this way, it's guaranteed that if something divides this number, then it it will also divide this number. Okay, and you can easily prove that. Not too difficult to prove. (Brady: Not the easiest process to run through but-)
- No it's not but then we're, you know, it's applying to any number. But this is, this is completely general thing now. (Brady: It doesn't apply to numbers divisible by 5. It almost applies to all the odd numbers but not-) The idea is that the goal is, the challenge of course is to get - you've got to get - it's very important that you get to this point where you have a something that ends in a 9, that's what you need. And then so you do this add 1 business blah, blah, blah, right? So that's, that's important as course that works with the 1s, 3s, 7s and 9s that you can do that for. (Brady: Do you like that?)
- It's general! It's not particularly - I mean, come on how good's your 23 times table Brady?
- (Brady: ...) Exactly.
- (Brady: But do you look at that and think, oh,) (that's a cute trick, or do you think awh that was a bit of a mess?) If you want to know what I like about it, is, so when I found out about it, a- sort of immediately wanted to prove it. Okay, I wanted to see why it works. That's what, that's what - and I think that's true of anybody who's sort of into maths is okay, it works, but why does it work? Let's prove it. You immediately sit down and prove it to yourself and you, and you understand why it works. And I think that's wh- what I liked when I saw why it worked. Which is in the proof. So I think we should leave the viewers to prove it, right? Here we go how, many numbers below 200 have exactly three divisors? For example 4 has 1, 2 and 4 itself, but how many more might exist? This is a new problem from Brilliant, today's episode sponsor. For a while I've been talking about Brilliant's problems of the week, but I'm excited to see they now have daily problems. I also like this one about chess boards and dominoes. Of course Brilliant still has all their top-end courses and quizzes spanning all sorts of mathematical and science topics, and they're still offering 20% off a premium subscription to Numberphile viewers. Simply go to brilliant.org/numberphile to check it out. There's plenty of free stuff on the site but a premium subscription might be worth a look. And after today's video I hope you might do well with questions like these ones. Our thanks to Brilliant, go to brilliant.org/numberphile for more information. [Outtakes] God, worst card trick ever Well, if you've got a patient audience, you guys, you can do this
I remember being extremely pleased with myself when I figured out a reason for the digit-sum method for 3 and 9, so I totally get Professor Padilla's enthusiasm for this. I later extrapolated to saying that the 3 method works in any base that's one more than a multiple of 3, which comes up a lot less frequently.