nav.gif (1245 bytes)mathematics

Ken Ward's Mathematics Pages

Number Theory Divisibility: Tests for Dividing by Numbers Relatively Prime to 10

See also Table of Rules for Testing Divisibility 2

Page Contents

  1. General Rule
    1. General Addition Rule
    2. General Subtraction Rule
    3. Reminder
  2. Explanation of the Method
  3. Creating New Formula
  4. Some Rules
    1. Division by 3
    2. Division by 5
    3. Division by 7
    4. Division by 13

The following rules refer only to divisibility by numbers relatively prime to 10. For rules for division by all numbers, (which are sometimes harder), see this page.

General Rule

Any integer number can be represented as:
    10a+b                     [1.1]
where b is non-negative integer less than 10: 0, 1, 2...9, and a is any positive integer. [Actually, 10a+b can be a negative integer, where 0>b>-10, and a is a negative integer, but here we think of non negatives for convenience in the knowledge that the negative version is easily obtained].

Here we consider numbers relatively prime to 10.

If Equation 1.1 is divisible by a number relatively prime to 10, p, such as 2, 3, 5..., then:
    10a+b=0 modp         [1.2]

So:
    b=-10a modp                 [1.3]

The above is the same for both rules.

General Addition Rule

We are seeking an integer, m, such that
    a+mb=0 modp              [1.4]

Substituting the value of b from 1.3 in 1.4:
    a+m(-10a)=0 modp     [1.5]

Factorising:
    a(1-10m)=0 modp      [1.6]

Now, 1.6 is divisible by p, if (1-10m) is.

    (1-10m)=-(10m-1), so if (1-10m) is divisible by p, so is (10m-1), which is sometimes easier to use!

For instance, if p=7, then we need (10m-1) to be divisible by 7 (and we take the lowest value). If m=5, then:
    1-10·5=49 (which is divisible by 7)

The rule for 7, is therefore: add 5 times the unit digit to the rest of the number, and if it is divisible by 7, then so is the number.

For instance, using the rule:
    196 gives 5·6+19=49

So, 196 is divisible by 7.

General Subtraction Rule

We continue from above
    10a+b=0 modp                 [1.2, repeated]

So:
    b=-10a modp                     [1.3, repeated]

We seek a rule:
    a-mb=0 mod p                 [1.2.1]

Substituting for b using Equation 1.3:
    a-(m(-10a))=0 mod p      [1.2.2]

Simplifying:
    a+10ma=0 mod p              [1.2.3]

Factorising:
    a(1+10m)=0 mod p            [1.2.3]

For the left-hand side to be divisible by p, the (1+10m) must be divisible by p. We search for the smallest m which makes (1+10m) divisible by p.

For instance, if p=7, then m=2 (1+10·2=21, which is divisible by 7)

Therefore the subtraction rule for 7 is: Double the last digit and add the rest of the number. If this is divisible by 7, then so is the number.

Example:

315 is divisible by 7 because 31-2·5=21, which is divisible by 7 (or 21 gives 2-2·1=0, which is divisible by 7)

Reminder

When seeking a rule, the addition rule uses (10m1) and the subtraction rule uses (10m+1). That is, minus for the addition rule, and plus for the subtraction rule!

For instance, in seeking the addition rule for 3, using (10m-1), we need to find a number multiplied by 3 which ends in 9. We find 9, itself. 9+1=10, so m=1.

In seeking the subtraction rule, using (10m+1), we seek a number which when multiplied by 3 ends in 1. 3*7=21, so m=2;

In seeking an addition rule for 13, using (10m-1), we seek a number which when multiplied by 13 ends in 9. 3*13=39. So m=4.

The subtraction rule for 13, using (10m-1), requires a number ending in 1... 13*7=91. So m=9.

Explanation of the Method

We can write the following:
    10a+b≡N                       [1.3.1]
Where N and a are non-negative integers, and b is a non-negative integer less than 10 (or a and N are negative integers and b is a negative integer greater than -10).

If N is divisible by an integer p, then so is the left-hand side. If we write Equation 1.3.1 modp, we get:
    10a+b≡0 modp              [1.3.2]

Dividing by 10, which we can do when p is prime (which is our assumption) so 10 and p are relatively prime:
    a+b/10≡0 modp              [1.3.3]

So, if the original number is divisible by p, then [1.3.3] is true. We can write 1/10 as mp, where mp is the value of 1/10 for a given p. So:
    mp≡1/10 modp                   [1.3.4]
And
    a+bmp≡0 modp                  [1.3.5]
For example, if p≡7, m7≡1/10 (mod 7), so 10m7≡1 (mod 7), 3m7≡1, so by trial and error, m7≡5 (mod 7)

Addition and Subtraction Rules

We now have a rule: We multiply the units by 1/10 modp and add the rest of the number. If the result is 0 modp, then the number is divisible by p.

We can also have a subtraction rule where:
    np≡−1/10 (mod p)                   [1.3.6]
And
    a-bnp≡0 (mod p)                  [1.3.7]
For instance, if p=7

By adding [1.3.4] and [1.3.7], we get:
    mp+np≡0 mod p

We can write:
    mp+np≡p mod p
because p mod p is 0. (we can write any multiple of p and get the same answer.)

Therefore, the sum of the factors for the addition rule and the subtraction rule is equal to p.  This means that having discovered one of the factors, we can easily compute the other.

For instance,
    with 7, the addition rule uses 5 and the subtraction rule uses 2, and 5+2=7!

Numbers for which the rule doesn't apply

We seek a number, m such that:
    m=1/10 mod p                       [1.3.8]

In other words:
    10m=1 mod p

(Also m is called the multiplicative inverse in mod p)

If p=2 or p=5, then 10m mod p is zero. So these numbers cannot be used (because we require 10m mod p to be 1, not zero). 

If p is an even number, then, because:
    10m mod p=10m-qp                [1.3.9]

where q is an integer, then because 10m and p are even, the difference will be an even number (and therefore cannot be equal to 1). For instance, 10 mod 8 is 2. There isn't a number, mod 8, which multiplied by 2 gives 1. (Actually there isn't a number at all, whatever the modulus!)

We can use our formula to find rules for checking divisibility of numbers which are not relatively prime to 10, that is, odd numbers except those ending in 5 or 0.

Seeking the m's for the relatively-prime-to 10 numbers

We can use our rule of thumb, that we find an for (1+10m) which is divisible by p for the Subtraction Rule, and an m for (1-10m) or (10m-1) for the Addition Rule.

It is quite easy with practice to figure out these rules mentally using the above, although here I will mention another method. Let us consider 13. So we seek an m:
10m=1 mod 13

Looking at an extract from the mod 13 times table for 10:
Table Mod 13
0123456789101112
10 0 10 7 4 1 11 8 5 2 12 9 6 3
11 0 11 9 7 5 3 1 12 10 8 6 4 2
12 0 12 11 10 9 8 7 6 5 4 3 2 1

We note that 10·4=1 mod13.

So for the addition rule we multiply the units by 4 and add the rest of the number.

For the subtraction rule we want:
    10m+1=0 mod 13

Or:
    10m=-1 mod 13

 -1 mod 13 =12
And:
    12·9=1 mod13.
So the subtraction rule is:
    subtract 9 times the units figure from the rest of the number.

Example for 13

    Addition rule:
        173 gives 17+4·3=29. 29 gives 2+4·9=38. 38 gives 3+4·8=35, which does not divide by 13 evenly so 173 doesn't have 13 as a divisor.

    Subtraction rule:
        173 gives 17-9·3=-10. 10 (the divisors of 10 and -10 are numerically the same!) gives 1-9·0=1, so it still doesn't divide by 13.

Creating New Formula

This is about creating new types formulae. Making up the formulae for different numbers using this Method 2 has already been dealt with above, and there is more below.

The purpose here is to exercise our new knowledge and not to find alternative formula in some practical way. The formula for Method 1 begin below.

We have used:
    10a+b=N

Now, we might use:
    100a+10b+c=N                   [1.4.1]

If N is divisible by p, then so is the left-hand side. So
    100a+10b+c=0 mod p          [1.4.2]

Dividing by 100:
    a+b/10+c/100=0 mod p        [1.4.3]

We can write 1.4.3 as:
    a+bm1+cm2=0 mod p          [1.4.4]

Where:
    m1=1/10 mod p,             [1.4.5] and
    m2=1/100 mod p            [1.4.6]

Seeking m's for 7

For instance, we can find these m's for 7.
    m1=1/10 mod 7,             [from 1.4.5] and
    m2=1/100 mod 7            [from 1.4.6]
    10 mod7=3
    100 mod7=2

So the m's we seek are:
    m1=1/3 mod 7,            
    m2=1/2 mod 7

From the table below, we find:
    m1=5 (3·5=1 mod7), and
    m2=4 (2·4=1 mod7)

Table Mod 7
0123456
0 0 0 0 0 0 0 0
1 0 1 2 3 4 5 6
2 0 2 4 6 1 3 5
3 0 3 6 2 5 1 4
4 0 4 1 5 2 6 3
5 0 5 3 1 6 4 2
6 0 6 5 4 3 2 1

Example

Rule: a+5b+4c=0 mod 7
Is 147 divisible by 7?    
    147 gives 1+5·4+4·7=49
    49 gives 5·4+4·9=56.
    56 gives 5·5+4·6=49
    49 gives 5·4+4·9=56
    
Whilst our new rule works, it seems to circle after slowly reducing the number.
We can rewrite it immediately as:
    a-(-5)b+4c=0 mod 7

And note that -5 mod 7=2. So
    a-2b+4c=0 mod 7

Trying our new new rule with 147:
    147 gives 1-(2·4)+4·7=21
    21 gives -(2·2)+4·1=0


The Division Rules


Division by 3

Addition Rule

For the addition rule, we want (10m-1) to be divisible by 3, and when m=1, this is so.
So the rule is :
    Add the units digit to the rest of the number, and if this is divisible by 3, then so is the number.

Example:
    711 gives 1·1+71=72.
    72 gives 2·1+7=9, which is divisible by 3, so 711 is divisible by 3.

Subtraction Rule

We need  (1+10m) to be divisible by 3. The smallest m is 2.
So the subtraction rule for 3 is
    Subtract twice the units digit from the rest of the number.

Example:
    711 gives 71-2·1=69.
    69 gives 6-2·9=12.
    12 gives 1-2·2=-3, which is divisible by 3.
In this case, these set of rules are more difficult than the Method 1 rule, so we would use that rule.

Division by 5

We need (10m-1) or (10m+1) to be divisible by 5. There is no "m" for which (10m-1) or (10m+1) is divisible by 5. (2 and 5 divide the base 10, and neither has a rule in this system.)  See the Method 1 method.

Division by 7

Addition Rule

We seek (10m-1) to be divisible by 7. When m=5, this is so.

Our rule is:
    Add 5 times the units figure to the rest of the number, and if the result is divisible by 5, then so is the number.

For instance:
    861 gives 86+5·1=91.
    91 gives 9+5·1-14.
    14 gives 1+5·4=21.
    21 gives 2+5·1=7, which is divisible by 7.

Subtraction Rule

We seek (10m+1) to be divisible by 7. When m=2, this is so.

Our rule is:
    Subtract twice the units figure to the rest of the number, and if this is divisible by 7, then so is the number.

For instance:
    861 gives 86-2·1=84.
    84 gives 8+2·8=24.
    24 gives 2-2·4=7, which is divisible by 7.

Division by 13


NumberPlus FactorMinus Factor
1349

Addition Rule for 13

Add 4 times the unit figure to the rest of the number. If the result is divisible by 13, so is the number.
Example
    1092 gives 109+4·2=117.
    117 gives 11+4·7=39
    39 gives 3+4·9=39
So we cannot go further than 39, which is divisible by 13, so 1092 is divisible by 13.

Subtraction Rule for 13

Subtract 9 times the units figure from the rest of the number. If the result is divisible by 13, so is the number.

    1092 gives 109-9·2=91.
    91 gives 9-9·1=0, which is divisible by 13, so 1092 is divisible by 13

Other rules can be discovered using Table of Rules for Testing Divisibility 2



Ken Ward's Mathematics Pages


Faster Arithmetic - by Ken Ward

Ken's book is packed with examples and explanations that enable you to discover more than 150 techniques to speed up your arithmetic and increase your understanding of numbers. Paperback and Kindle:
Buy now at Amazon.com
Faster Arithmetic for Adults