Re: I was about to say "wrong" - solution
Larry Barrett
Objective is to find a number N that contains 7 consecutive, scrambled, digits that satisfies the conditions stated in Alex’s problem. One of the conditions requires testing each new number to determine if it is divisible by three – the 6-digit number must be divisible by three (and not by nine), but none of the other numbers (including the objective number) is divisible by three. There are lots of numbers to be tested, and one way to avoid the use of a calculator is to use the rule for determining if a number is divisible by three (or by nine). This is one of those things you might have learned in HS but may have forgotten. The rule is that a number is evenly divisible by three if the sum of the digits in the number is divisible by three, and similarly, a number is evenly divisible by nine if the sum of the digits in the number is divisible by nine. For example, the sum of the digits in the number 132 is six, which is divisible by three, but not by nine. So the rule tells you that the number 132 is divisible by 3, but not by nine and you don’t need a calculator to find out. Since the order of the digits doesn’t matter, the same rule applies to the numbers 123, 321, 312, etc. All are divisible by three, but not by nine. Pretty handy for Alex’s problem.
So the possible starting sets for N are these sets of consecutive integers:
1) 0 1 2 3 4 5 6
2) 1 2 3 4 5 6 7
3) 2 3 4 5 6 7 8
4) 3 4 5 6 7 8 9
Since N will contain all of the digits in a set, we can use the ‘rule of three’ to eliminate sets 1 and 4, since the sum of the digits in these sets is 21 and 42, respectively, and any N formed from sets 1 or 4 will therefore be divisible by three. We can also eliminate set 3; it contains 4 even digits (2,4,6,8) and only three odd digits (3,5,7), and we know from the original problem that as new numbers are formed by removing digits alternating from left, then right (and the reverse sequence for the second set of numbers), each new number (including the original number) is always odd. So the possible starting sets must contain 4 odd digits, thus eliminating set 3. So N must be formed by arranging the digits in set 2 in some order; we know that the 4 odd digits must be right-most 4 digits in N, and we also know that the digit 3 cannot be the central digit in N since it is divisible by three.
Consider the set 1 2 3 4 5 6 7. The sum of these 7 digits is 28. New numbers will be formed by dropping digits - left-most, then right-most, then left-most, …, (and vice-versa). As a first step, we want to see if we can discover which two digits can be dropped from this set that will form the 6-digit numbers that will be divisible by three (but not by nine). When the digit 1 is removed the sum is 27 - divisible by both three and nine - so 1 cannot be either the left-most or the right-most digit in N. Continue testing this set by removing one digit at a time (2, then 3, then 4, etc., but retaining the remaining 6 digits); doing this, we see that the sum of the remaining digits is 26, 25, 24, 23, 22, 21, respectively. Observe that when 4 is removed, the sum of the remaining digits is 24 - divisible by three, but not by nine, and when 7 is removed the sum is 21, also divisible by three but not by nine. Since 4 and 7 are the only digits that satisfy this test, we can conclude that N must start with 4 and end with 7. The remaining three odd digits will be the right-most digits, and 3 will not the central digit.
So N could be 4261357, or 4621357, or 4265137, etc. To make further progress in determining N, we have to test each new number formed by dropping digits, using the ‘rule of three’ to verify divisibility by three, or not. For example, suppose we try the number 4261357. (For this example we will follow the ‘drop the left-most digit to form a 6 digit number, drop the right-most digit to form a 5 digit number, etc. A similar test must be made following the reverse set of steps). Dropping the left-most digit forms the 6 digit number 261357, which we already know is divisible by three, but not by nine. Now drop the right-most digit to form the 5 digit number 26135. The sum of the digits in this number is 17, not divisible by 3, so still OK. Now drop the left-most digit to form the 4 digit number 6135. The sum of the digits in 6135 is 15 - divisible by 3. So we must reject 4261357 and start anew. Continuing in this manner, we find that 4625317 works for all tests, and thus must be Alex’s number.