Is the number N divisible by…. 2? 3? 5?

Everyone knows the first trick:

**N is divisible by 2**** if its last digit is 0, 2, 4, 6, or 8** (that is, the last digit is even).

Most people know the next trick:

**N is divisible by 3 if the sum of the digits is also divisible by 3.**

You can repeat this rule too.

For example: Is the number 93,225 is divisible by 3? Well…

**9+3+2+2+5 = 21**

And, 21 is divisible by 3, hence 93,225 is divisible by 3.

**N is divisible by 4 if the last two digits form a number divisible by 4.**

Let’s

do an example: Is the number 23894723985729316 divisible by 4? Well the

The last two digits are 16 and 16 is divisible by 4, so YES!

**N is divisible by 5 if it ends in 0 or 5.**

For 6, we just combine the rules for 2 and 3:

**N is divisible by 6 if it is divisible by both 2 and 3.**

For the rest, we will stick with prime divisors p.

Consider multiples M of p until:

**M*p+1=0 (mod 10)**

We want the smallest such M.

Take

**n = (Mp+1)/10**

Consider n and p-n, and usually, we just pick the lowest.

Now,

to find out if a number is divisible by p, take the last digit of the

number, multiply it by n and add it to the rest of the number (OR:

multiply it by (p – n) and subtract it from the rest of the number).

If you get an answer divisible by p (note that this includes 0), then

the original number is divisible by p. Repeat the rule if you don’t

know the new number’s divisibility.

Now try to see if you can come up with the rule for 7! One thing you might find interesting is the following post that discusses using a ‘divisibility graph‘ for 7.