Test if a number is divisible by 6
Submitted by Isoscel on Sat, 11/17/2007 - 16:58.
How to test if a number is divisible by 6?
A number is divisible by 6 if and only if that number is divisible by 2 and also divisible by 3.
A number is divisible by 3 if the some of its digits is divisible by 3.
A number is divisible by 2 if its last digit is even.
So a number is divisible by 6 if its last digit is even and the some of its digits is divisible by 3.
For example:
852 is divisible by 6 because its last digit is even and the sum of its digits (8 + 5 + 2 = 15) is divisible by 3.
216 is divisible by 6 because its last digit is even and the sum of its digits (2 + 1 + 6 = 9) is divisible by 3.