B5. The eleven-digit number ' $A 123456789 B$ ' is divisible by exactly eight of the numbers $1,2,3,4,5,6,7,8,9$. Find the values of $A$ and $B$, explaining why they must have these values.
Solution
Let the eleven-digit number ' $A 123456789 B$ ' be $N$.
First note that $N$ is divisible by least two of 2,4 and 8 . Therefore it is divisible by 4 . So $B$ is not 5 . A number is divisible by 4 if, and only if, its last two digits form a number divisible by 4 . Hence $B$ is not 0 as 90 is not divisible by 4 . So $N$ is not divisible by 5 , but is divisible by each of the numbers $1,2,3,4,6,7,8$, 9. A number is divisible by 8 if, and only if, its last three digits form a number divisible by 8 . Therefore, for $N$ to be divisible by $8, B$ is 6 as 896 is the only number between 890 and 899 inclusive which is divisible by 8 . $N$ is also divisible by 9 , which means that the sum of its digits is also divisible by 9 . Hence $A+51$ is divisible by 9 . Therefore $A$ is 3 and, as has been shown, $B$ is 6 . (As 31234567896 is divisible by both 8 and 9, it is clearly also divisible by 1, 2, 3, 4 and 6 . It is left to the reader to check that 31234567896 is also divisible by 7.)