Ways to test for divisibility by single-digit numbers in
base 10:
- 1
- This is here for completeness. Every integer is divisible by 1.
- 2
- The last digit is 0, 2, 4, 6, or 8.
- 3
- The sum of the digits is divisible by 3. (If you are dealing with a freaking huge number you can apply this recursively.)
- 4
- The last two digits form a number which is itself divisible by 4.
- 5
- The last digit is 0 or 5.
- 6
- The sum of the digits is divisible by 3 and the last digit is 0, 2, 4, 6, or 8.
- 7
- I defer to how to determine whether a number is divisible by 7.
- 8
- Either:
- The hundreds place is even, and the last two digits form a number which is divisible by 8.
- orThe hundreds place is odd, and the last two digits minus 4 form a number which is divisible by 8.
- 9
- The sum of the digits is divisible by 9.
Divisibility is not symmetric. a | b usually doesn't imply b | a. The property that a | a means that divisibility is
reflexive.