Coding for everyone

Head of Linked List:

Go Fish

Go Fish

It's rather obvious when a number is divisible by 2 or 5, and some of you probably know how to tell if a number is divisible by 3, but it is possible to figure out the division 'rule' for any number. Here are the rules for 2 through 11...

## 2

The last digit is divisible by 2.

## 3

The sum of all the digits in the number is divisible by 3.

## 4

The last 2 digits are divisible by 4.

## 5

The last digit is 5 or 0.

## 6

The number is both divisible by 2 and divisible by 3.

## 7

Cut the number into 2 parts: the last digit and everything else before that. You now have 2 numbers. Take the number that was the last digit and multiply it by 2. Now subtract that from the other number. If this new number is also divisible by 7, then the original number was divisible by 7.

Is 854 divisible by 7?

Number A: 85

Number B: 4

Number A - 2 * Number B = 85 - 2 * 4 = 77

77 is most certainly divisible by 7, therefore 854 is also divisible by 7

## 8

The last 3 digits are divisible by 8

## 9

The sum of all the digits in the number is divisible by 9.

## 10

The last digit is a 0.

## 11

Break the number into two parts (like you did for the division by 7 rule). This time just subtract the two numbers (without multiplying by 2). If that new number is divisible by 11 then the original number is divisible by 11.

Also there is a quick way for determining divisibility by 11 for 3-digit numbers:

If the inner digit is larger than the two outer digits, then it is divisible by 11 if the inner digit is the sum of the two outer digits. If the inner digit is not bigger than both the outer digits, then carry the 1 from the hundreds place.

187 is divisible by 11 because 1 + 7 = 8

When examining 407 for divisibility by 11, don't think of it as 4, 0, and 7, but 3, 10, and 7. 3 + 7 = 10 so 407 is divisible by 11.

General Formula

Are you ready to hear the general formula to figure out the rule for any divisor? Here goes...

## Rules for all divisors ending in 1...

For example, to tell if a number is divisible by 31, multiply the last digit of a number by 3 and subtract it from the rest of the number.

34379 is divisible by 31

3437 - 9*3 = 3410 which is also divisible by 31, therefore 34379 is divisible by 31.

## Rules for all divisors ending in 3

## Rules for all divisors ending in 7

## Rules for all divisors ending in 9

To see if a number is divisible by 2^n or 5^n, check to see if the last n digits are divisble by 2^n or 5^n. For example, 123489012349375 is divisible by 5^3 because the last 3 digits are divisible by 125.

You can also combine division rules for composite numbers. For example, to tell if a number is divisible by 3298 (2*17*97) it must be divisible by 2, 17, and 97 which you can now figure out the rules for.

Using these rules and patterns in different combinations, you can figure the divisibility rules for absolutely any integer divisor.

Is 854 divisible by 7?

Number A: 85

Number B: 4

Number A - 2 * Number B = 85 - 2 * 4 = 77

77 is most certainly divisible by 7, therefore 854 is also divisible by 7

Also there is a quick way for determining divisibility by 11 for 3-digit numbers:

If the inner digit is larger than the two outer digits, then it is divisible by 11 if the inner digit is the sum of the two outer digits. If the inner digit is not bigger than both the outer digits, then carry the 1 from the hundreds place.

187 is divisible by 11 because 1 + 7 = 8

When examining 407 for divisibility by 11, don't think of it as 4, 0, and 7, but 3, 10, and 7. 3 + 7 = 10 so 407 is divisible by 11.

General Formula

Are you ready to hear the general formula to figure out the rule for any divisor? Here goes...

Divisor | Multiply last digit by... |

11 | 1 (begin with 1) |

21 | 2 |

31 | 3 |

41 | 4 |

51 | 5 (add 1 each time) |

and so on... |

For example, to tell if a number is divisible by 31, multiply the last digit of a number by 3 and subtract it from the rest of the number.

34379 is divisible by 31

3437 - 9*3 = 3410 which is also divisible by 31, therefore 34379 is divisible by 31.

Divisor | Multiply last digit by... |

3 | 2 (begin with 2) |

13 | 9 |

23 | 16 |

33 | 23 |

43 | 30 |

53 | 37 (add 7 each time) |

and so on... |

Divisor | Multiply last digit by... |

7 | 2 (begin with 2) |

17 | 5 |

27 | 8 |

37 | 11 |

47 | 14 |

57 | 17 (add 3 each time) |

and so on... |

Divisor | Multiply last digit by... |

9 | 8 (begin with 2) |

19 | 17 |

29 | 26 |

39 | 35 |

49 | 44 |

59 | 53 (add 9 each time) |

and so on... |

To see if a number is divisible by 2^n or 5^n, check to see if the last n digits are divisble by 2^n or 5^n. For example, 123489012349375 is divisible by 5^3 because the last 3 digits are divisible by 125.

You can also combine division rules for composite numbers. For example, to tell if a number is divisible by 3298 (2*17*97) it must be divisible by 2, 17, and 97 which you can now figure out the rules for.

Using these rules and patterns in different combinations, you can figure the divisibility rules for absolutely any integer divisor.