Some of the secrets of the mathematical ninja are pretty pointless, when you come down to it: after all, we have machines for most of these things. The divisibility tricks are useful (as far as I can see) only in a very specific circumstance: when you’re deciding whether to cancel down a fraction.

In that case, it’s worth doing a quick check to see which numbers your top and bottom can divide by. No matter how big the numbers are, you can always check these divisibility tricks to see whether it’s worth doing long division on a number.

### The Last Digit: 10, 5 and 2

Let’s start with the ones (nearly) everyone knows: if a number ends in a 0, you can divide it by 10 - easily, too, you just knock off the last zero.

Five isn’t much harder - if you look at your five times table, you’ll notice the last digit toggles back and forth between 0 and 5. Any number that ends in 5 or 0 is definitely a multiple of 5.

Finally (for the easy ones), it’s easy to spot a number you can divide by two: it’s just an even number. If it ends in 2, 4, 6, 8 or 0, you can divide by two. Woohoo!

### The last few digits: 4 and 8

In terms of sums you’re likely to do, it’s probably overkill to know whether something is a multiple of 4 or 8 - our arch-nemesis the mathematical pirate would simply divide by two and see if the result was even. And do it again if he was curious about 8.

But here in ninja-world, we are not so brutal. Here in ninja-world, we like the elegant solution. To find whether something is divisible by four, you check whether the last two digits are divisible by 4. How can you tell if a two-digit number is in the four times table? Well, you can do it by casting out fours. If you have something like 76, you can take away a four from either digit without changing whether it’s a multiple of 4. So, you can turn it into 36 (taking 4 from the 7), 72 (taking 4 from the 6) or even 32 (taking 4 from both). Oh lookit, they’re all multiples of four.

Multiples of 8 are trickier: the last three digits need to be a multiple of 8. You can do something similar to before to work this out - given something like 976, you can turn that into 176, taking 8 from the 9. Then you can take 8 from the 17 (a sneaky ninja trick if ever there was one) to get 96, which becomes 16. It’s in the 8 times table.

### Divisibility tricks by adding up: 3 and 9

The divisibility tricks for three and nine are easier to deal with than the others, but need a little bit of adding up on the way. The trick here is to add up the digits. If they add up to a multiple of 3, then the original number is a multiple of 3. If they add up to a multiple of 9, then it’s a multiple of 9. (Three and nine are the only numbers this works for).

So, for instance, the digits of 314,159,265 add up to 36, meaning it’s divisible by both 9 and 3. (And - using the earlier rules, 5, but not 2, 4, 8 or 10).

### The odd man out: 7

Seven is harder than the others. I know two good divisibility tricks for it, though: the double-and-subtract trick and the folding-thousands trick.

If you have a big number, the folding thousands trick is the best one. To see if a big number is a multiple of seven, split the number into two parts - the bit before the last comma and the bit after it. For 314,159,265, that would be 314,159 and 265. Find the difference between them (the folding): it’s 313,894. Repeat the trick with 313 and 894, you get 581. If this is a multiple of 7, then so is the original number!

But is 581 a multiple of 7? Actually, it is - and I know because of the double and subtract trick. For this one, you split the number before the final digit (58 and 1). Double the final digit and find the difference again - here it’s 58 - 2 = 56. If this is a multiple of 7 (and it is!), then so was the original number.

So, that tells us that 314,159,265 is a multiple of (at least) 5, 7 and 9. (Also three, but all multiples of nine are automatically multiples of 3).

(Credit where it’s due: hat tip to Guillermo for the double-and-subtract divisibility trick.)