626 lines
10 KiB
Markdown
626 lines
10 KiB
Markdown
---
|
||
title: "Divisibility rule"
|
||
chunk: 8/8
|
||
source: "https://en.wikipedia.org/wiki/Divisibility_rule"
|
||
category: "reference"
|
||
tags: "science, encyclopedia"
|
||
date_saved: "2026-05-05T08:13:56.367542+00:00"
|
||
instance: "kb-cron"
|
||
---
|
||
|
||
=== Proof using basic algebra ===
|
||
Many of the simpler rules can be produced using only algebraic manipulation, creating binomials and rearranging them. By writing a number as the sum of each digit times a power of 10 each digit's power can be manipulated individually.
|
||
|
||
==== Case where all digits are summed ====
|
||
This method works for divisors that are factors of 10 − 1 = 9.
|
||
Using 3 as an example, 3 divides 9 = 10 − 1. That means
|
||
|
||
|
||
|
||
10
|
||
≡
|
||
1
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
3
|
||
)
|
||
|
||
|
||
|
||
{\displaystyle 10\equiv 1{\pmod {3}}}
|
||
|
||
(see modular arithmetic). The same for all the higher powers of 10:
|
||
|
||
|
||
|
||
|
||
10
|
||
|
||
n
|
||
|
||
|
||
≡
|
||
|
||
1
|
||
|
||
n
|
||
|
||
|
||
≡
|
||
1
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
3
|
||
)
|
||
|
||
.
|
||
|
||
|
||
{\displaystyle 10^{n}\equiv 1^{n}\equiv 1{\pmod {3}}.}
|
||
|
||
They are all congruent to 1 modulo 3. Since two things that are congruent modulo 3 are either both divisible by 3 or both not, we can interchange values that are congruent modulo 3. So, in a number such as the following, we can replace all the powers of 10 by 1:
|
||
|
||
|
||
|
||
|
||
100
|
||
⋅
|
||
a
|
||
+
|
||
10
|
||
⋅
|
||
b
|
||
+
|
||
1
|
||
⋅
|
||
c
|
||
≡
|
||
(
|
||
1
|
||
)
|
||
a
|
||
+
|
||
(
|
||
1
|
||
)
|
||
b
|
||
+
|
||
(
|
||
1
|
||
)
|
||
c
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
3
|
||
)
|
||
|
||
,
|
||
|
||
|
||
{\displaystyle 100\cdot a+10\cdot b+1\cdot c\equiv (1)a+(1)b+(1)c{\pmod {3}},}
|
||
|
||
|
||
which is exactly the sum of the digits.
|
||
|
||
==== Case where the alternating sum of digits is used ====
|
||
This method works for divisors that are factors of 10 + 1 = 11.
|
||
Using 11 as an example, 11 divides 11 = 10 + 1. That means
|
||
|
||
|
||
|
||
10
|
||
≡
|
||
−
|
||
1
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
11
|
||
)
|
||
|
||
|
||
|
||
{\displaystyle 10\equiv -1{\pmod {11}}}
|
||
|
||
. For the higher powers of 10, they are congruent to 1 for even powers and congruent to −1 for odd powers:
|
||
|
||
|
||
|
||
|
||
|
||
10
|
||
|
||
n
|
||
|
||
|
||
≡
|
||
(
|
||
−
|
||
1
|
||
|
||
)
|
||
|
||
n
|
||
|
||
|
||
≡
|
||
|
||
|
||
{
|
||
|
||
|
||
|
||
1
|
||
|
||
|
||
|
||
if
|
||
|
||
n
|
||
|
||
is even
|
||
|
||
,
|
||
|
||
|
||
|
||
|
||
−
|
||
1
|
||
|
||
|
||
|
||
if
|
||
|
||
n
|
||
|
||
is odd
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
11
|
||
)
|
||
|
||
.
|
||
|
||
|
||
{\displaystyle 10^{n}\equiv (-1)^{n}\equiv {\begin{cases}1&{\text{if }}n{\text{ is even}},\\-1&{\text{if }}n{\text{ is odd}}\end{cases}}{\pmod {11}}.}
|
||
|
||
|
||
Like the previous case, we can substitute powers of 10 with congruent values:
|
||
|
||
|
||
|
||
|
||
1000
|
||
⋅
|
||
a
|
||
+
|
||
100
|
||
⋅
|
||
b
|
||
+
|
||
10
|
||
⋅
|
||
c
|
||
+
|
||
1
|
||
⋅
|
||
d
|
||
≡
|
||
(
|
||
−
|
||
1
|
||
)
|
||
a
|
||
+
|
||
(
|
||
1
|
||
)
|
||
b
|
||
+
|
||
(
|
||
−
|
||
1
|
||
)
|
||
c
|
||
+
|
||
(
|
||
1
|
||
)
|
||
d
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
11
|
||
)
|
||
|
||
,
|
||
|
||
|
||
{\displaystyle 1000\cdot a+100\cdot b+10\cdot c+1\cdot d\equiv (-1)a+(1)b+(-1)c+(1)d{\pmod {11}},}
|
||
|
||
|
||
which is also the difference between the sum of digits at odd positions and the sum of digits at even positions.
|
||
|
||
==== Case where only the last digit(s) matter ====
|
||
This applies to divisors that are a factor of a power of 10. This is because sufficiently high powers of the base are multiples of the divisor, and can be eliminated.
|
||
For example, in base 10, the factors of 101 include 2, 5, and 10. Therefore, divisibility by 2, 5, and 10 only depend on whether the last 1 digit is divisible by those divisors. The factors of 102 include 4 and 25, and divisibility by those only depend on the last 2 digits.
|
||
|
||
==== Case where only the last digit(s) are removed ====
|
||
Most numbers do not divide 9 or 10 evenly, but do divide a higher power of 10n or 10n − 1. In this case the number is still written in powers of 10, but not fully expanded.
|
||
For example, 7 does not divide 9 or 10, but does divide 98, which is close to 100. Thus, proceed from
|
||
|
||
|
||
|
||
|
||
100
|
||
⋅
|
||
a
|
||
+
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle 100\cdot a+b,}
|
||
|
||
|
||
where in this case a is any integer, and b can range from 0 to 99. Next,
|
||
|
||
|
||
|
||
|
||
(
|
||
98
|
||
+
|
||
2
|
||
)
|
||
⋅
|
||
a
|
||
+
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle (98+2)\cdot a+b,}
|
||
|
||
|
||
and again expanding
|
||
|
||
|
||
|
||
|
||
98
|
||
⋅
|
||
a
|
||
+
|
||
2
|
||
⋅
|
||
a
|
||
+
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle 98\cdot a+2\cdot a+b,}
|
||
|
||
|
||
and after eliminating the known multiple of 7, the result is
|
||
|
||
|
||
|
||
|
||
2
|
||
⋅
|
||
a
|
||
+
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle 2\cdot a+b,}
|
||
|
||
|
||
which is the rule "double the number formed by all but the last two digits, then add the last two digits".
|
||
|
||
==== Case where the last digit(s) is multiplied by a factor ====
|
||
The representation of the number may also be multiplied by any number relatively prime to the divisor without changing its divisibility. After observing that 7 divides 21, we can perform the following:
|
||
|
||
|
||
|
||
|
||
10
|
||
⋅
|
||
a
|
||
+
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle 10\cdot a+b,}
|
||
|
||
|
||
after multiplying by 2, this becomes
|
||
|
||
|
||
|
||
|
||
20
|
||
⋅
|
||
a
|
||
+
|
||
2
|
||
⋅
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle 20\cdot a+2\cdot b,}
|
||
|
||
|
||
and then
|
||
|
||
|
||
|
||
|
||
(
|
||
21
|
||
−
|
||
1
|
||
)
|
||
⋅
|
||
a
|
||
+
|
||
2
|
||
⋅
|
||
b
|
||
.
|
||
|
||
|
||
{\displaystyle (21-1)\cdot a+2\cdot b.}
|
||
|
||
|
||
Eliminating the 21 gives
|
||
|
||
|
||
|
||
|
||
−
|
||
1
|
||
⋅
|
||
a
|
||
+
|
||
2
|
||
⋅
|
||
b
|
||
,
|
||
|
||
|
||
{\displaystyle -1\cdot a+2\cdot b,}
|
||
|
||
|
||
and multiplying by −1 gives
|
||
|
||
|
||
|
||
|
||
a
|
||
−
|
||
2
|
||
⋅
|
||
b
|
||
.
|
||
|
||
|
||
{\displaystyle a-2\cdot b.}
|
||
|
||
|
||
Either of the last two rules may be used, depending on which is easier to perform. They correspond to the rule "subtract twice the last digit from the rest".
|
||
|
||
=== Proof using modular arithmetic ===
|
||
This section will illustrate the basic method; all the rules can be derived following the same procedure. The following requires a basic grounding in modular arithmetic; for divisibility other than by 2's and 5's the proofs rest on the basic fact that 10 mod m is invertible if 10 and m are relatively prime.
|
||
|
||
==== For 2n or 5n ====
|
||
Only the last n digits need to be checked.
|
||
|
||
|
||
|
||
|
||
|
||
10
|
||
|
||
n
|
||
|
||
|
||
=
|
||
|
||
2
|
||
|
||
n
|
||
|
||
|
||
⋅
|
||
|
||
5
|
||
|
||
n
|
||
|
||
|
||
≡
|
||
0
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
|
||
2
|
||
|
||
n
|
||
|
||
|
||
|
||
or
|
||
|
||
|
||
5
|
||
|
||
n
|
||
|
||
|
||
)
|
||
|
||
.
|
||
|
||
|
||
{\displaystyle 10^{n}=2^{n}\cdot 5^{n}\equiv 0{\pmod {2^{n}{\text{ or }}5^{n}}}.}
|
||
|
||
|
||
Representing x as
|
||
|
||
|
||
|
||
|
||
10
|
||
|
||
n
|
||
|
||
|
||
⋅
|
||
y
|
||
+
|
||
z
|
||
,
|
||
|
||
|
||
{\displaystyle 10^{n}\cdot y+z,}
|
||
|
||
|
||
|
||
|
||
|
||
x
|
||
=
|
||
|
||
10
|
||
|
||
n
|
||
|
||
|
||
⋅
|
||
y
|
||
+
|
||
z
|
||
≡
|
||
z
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
|
||
2
|
||
|
||
n
|
||
|
||
|
||
|
||
or
|
||
|
||
|
||
5
|
||
|
||
n
|
||
|
||
|
||
)
|
||
|
||
,
|
||
|
||
|
||
{\displaystyle x=10^{n}\cdot y+z\equiv z{\pmod {2^{n}{\text{ or }}5^{n}}},}
|
||
|
||
|
||
and the divisibility of x is the same as that of z.
|
||
|
||
==== For 7 ====
|
||
Since 10 × 5 ≡ 10 × (−2) ≡ 1 (mod 7), we can do the following:
|
||
Representing x as
|
||
|
||
|
||
|
||
10
|
||
⋅
|
||
y
|
||
+
|
||
z
|
||
,
|
||
|
||
|
||
{\displaystyle 10\cdot y+z,}
|
||
|
||
|
||
|
||
|
||
|
||
−
|
||
2
|
||
x
|
||
≡
|
||
y
|
||
−
|
||
2
|
||
z
|
||
|
||
|
||
(
|
||
mod
|
||
|
||
7
|
||
)
|
||
|
||
,
|
||
|
||
|
||
{\displaystyle -2x\equiv y-2z{\pmod {7}},}
|
||
|
||
|
||
so x is divisible by 7 if and only if y − 2z is divisible by 7.
|
||
|
||
== See also ==
|
||
Division by zero
|
||
Parity (mathematics)
|
||
|
||
== References ==
|
||
|
||
== Sources ==
|
||
Apostol, Tom M. (1976). Introduction to analytic number theory. Undergraduate Texts in Mathematics. Vol. 1. Springer-Verlag. ISBN 978-0-387-90163-3.
|
||
Kisačanin, Branislav (1998). Mathematical problems and proofs: combinatorics, number theory, and geometry. Plenum Press. ISBN 978-0-306-45967-2.
|
||
Richmond, Bettina; Richmond, Thomas (2009). A Discrete Transition to Advanced Mathematics. Pure and Applied Undergraduate Texts. Vol. 3. American Mathematical Soc. ISBN 978-0-8218-4789-3.
|
||
|
||
== External links ==
|
||
|
||
Divisibility Criteria at cut-the-knot
|
||
Stupid Divisibility Tricks Divisibility rules for 2–100. |