3 ms·
I know: * 2 - if it ends in 0,2,4,6,8, it's divisible by 2 * 3 - if the sum of the digits is divisible by 3, so is the number * 4 - Ignore everything but the
by jackowayed 16y ago
I know:
* 2 - if it ends in 0,2,4,6,8, it's divisible by 2
* 3 - if the sum of the digits is divisible by 3, so is the number
* 4 - Ignore everything but the last 2 digits. If the last 2 digits make a number that's divisible by 4, the whole number is (eg. anything ending in 52 is divisible by 4 because 52 is divisible by 4)
* 5 - If it ends in 0 or 5, it's divisible by 5.
* 6 - do an and of the 2 and 3 tests.
* 8 - Same as the 4 test, only last 3 digits.
* 9 - same as 3, only the digit sum needs to be divisible by 9 instead of 3
* 10 - If it ends in 0, it's divisible by 10.
So I guess the only one I don't know is 11.
- skmurphy 16y ago11 = add the first, third, fifth, etc.. digits, if the sum matches that for the second, fourth, sixth, etc.. then the number is divisible by 11.
- TheNewAndy 16y agoNot quite: 5060 is an exception to your rule. As described before, if (even digit sum) - (odd digit sum) is divisible by 11, then the number is divisible by 11.
- skmurphy 16y agoIf you are not careful you will learn something new. Thanks for the tip.