Don't worry, I'm not selling anything. Just giving a shoutout to one of my open-source side projects:
I created a programming language for beginners and am looking for people to test it out. If you have a spare moment (particularly if you haven't programmed before) and you're interested in making 2D games, please check it out.
Divisibility Rules for Arbitrary DivisorsIt'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...
2The last digit is divisible by 2.
3The sum of all the digits in the number is divisible by 3.
4The last 2 digits are divisible by 4.
5The last digit is 5 or 0.
6The number is both divisible by 2 and divisible by 3.
7Cut 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
8The last 3 digits are divisible by 8
9The sum of all the digits in the number is divisible by 9.
10The last digit is a 0.
11Break 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.
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.