Friday, May 16, 2008

Digit In-A-Box

For today I have another question from Yahoo Answers. It's very original and interesting, and even worth trying out before going over to the answer.

Joe and Joana are playing a game. Joana is picking up between 2-9 boxes and puts a digit in each box, so the number that comes out when the digits are read from left to right is divisible by the number of boxes. For example, if Joana picks 4 boxes, she can use the digits 1,2,7,9 to create the number 1972, but not 7129. Joe must switch any two boxes that he wants. If the number is still divisible by the number of boxes, Joe wins. Otherwise, Joana wins. What number of boxes Joana must pick to always win?

This calls out for some divisibility rules. Let's see how Joe can always win for a number of boxes, and we'll start with 9:

9: it doesn't matter which boxes Joe moves, he wins. When a number is divisible by 9, the sum of its digits is also divisible by 9. Since addition is commutative, it doesn't matter which order the digits are: their sum will remain the same and they'll be divisible by 9.

8: the divisibility of a number by 8 depends on its last 3 digits. As long as Joe doesn't touch the last three digits, the number will be divisible by 8.

7: This is quite tricky, because it doesn't use the divisibility rule of 7 (which you can find on super math tips and tricks), but simple math. Since Joana uses 7 boxes here, there are 7 digits, and the number can be written as a sum:
1000000a + 100000b + 10000c + 1000d + 100e + 10f + g
When we replace the first and last digit, we subtract g and add 1000000g and also subtract 1000000a and add one a. This means the total operation is:
+1000000g - g - 1000000a + a = +999999g - 999999a = 999999(g - a).
Luckily for Joe, 999,999 is divisible by 7, so 999999(g - a) is also divisible by 7. That way, Joe adds or subtracts from a number divisible by 7 another number divisible by 7, and doesn't change its divisibility.

6: a number is divisible by 6 if it's divisible by 3 and 2, which means the sum of its digits must by divisible by 3 and it must be even. As long as Joe doesn't touch the last digit, he wins.

5: a number is divisible by 5 if the last digit is either 5 or 0, so as long as Joe doesn't touch the last digit, he wins.

4: a number's divisibility by 4 is determined by its last two digits, so Joe must replace only the first two to win.

3: a number is divisible by 3 if the sum of its digits is divisible by 3, so just like 9, Joe can switch any boxes he wants.

2: a number is divisible by 2 if it ends with 2, 4, 6, 8, or 0. However, since Joe MUST switch two boxes, Joana may pick an even number with one odd digit, like 74. When Joe switches the boxes, he'll get 47, which is odd, so Joana wins.

The final answer: Joana must use a 2-digit number to win.

And a final notice: I added a sign up form for Super Math Tips on the right column of this blog, for easy access.

Have a great weekend,
Nadav

nadavs

No comments: