Lite

## Rex and Ralph: Mystery Number

 Category: Math Submitted By: javaguru Fun: (2.62) Difficulty: (3.23)

Two mathematicians, Rex and Ralph, have an ongoing competition to stump each other. Ralph was impressed by the ingenuity of Rex's last attempt using clues involving prime numbers, but he thinks he's got an even better one for Rex. He tells Rex he's thinking of a 6-digit number.

"All of the digits are different. The digital sum matches the number formed by the last two digits in the number. The sum of the first two digits is the same as the sum of the last two digits."

"Take the sum of the number, the number rotated one to the left, the number rotated one to the right, the number with the first three and last three digits swapped, the number with the digit pairs rotated to the left, and the number with the digit pairs rotated to the right. The first and last digits of this sum match the last two digits of the number, in some order."

Ralph then asks, "If each of the three numbers formed by the digit pairs in the number is prime, then what is the number?"

Rex looks confused, and for a moment Ralph thinks he's finally gotten him. Then Rex smiles, scribbles a few things down on a pad of paper and then says, "Very nice, Ralph!"

Rex then tells Ralph his number.

What did Rex say?

(See the hint for an explanation of the terminology.)

416723

Here's how Rex determined Ralph's number:

The insight Rex needed to solve this involves the number produced by the sum of the six numbers created from configurations of the digits in the number. Assign ABCDEF to the digits in Ralph's number. The six numbers Ralph had Rex add together were:

ABCDEF
BCDEFA
FABCDE
DEFABC
CDEFAB
EFABCD

Notice that the six digits in each column in this summation are the six digits in the number. This means that the sum of each column will be the digital sum of the number. If that digital sum is represented by A+B+C+D+E+F = XY, then the problem is equivalent to adding:

XXXXXX0
+YYYYYY

The first and last digits will be X and Y only if 10 > X + Y. If X + Y is greater than 9, then the first digit will be X+1. Since both the digital sum of the number (A+B+C+D+E+F) and the first and last digit of the sum of the numbers match the digits XY, you know that 10 > X + Y. When Rex realized this relation he smiled because he knew that he had enough information now.

The digital sum of the number must be between 0+1+2+3+4+5 = 15 and 9+8+7+6+5+4 = 39. Since each of the digit pairs in the number form a prime number, the digital sum must be a prime number in this range. There are only six prime numbers in this range: 17, 19, 23, 29, 31, and 37. 19, 29 and 37 are eliminated since 1+9 > 9, 2+9 > 9 and 3+7 > 9.

The sum of the first two digits must match the sum of the last two digits (X+Y). For 31, 3+1=4, but the only other way to make four without repeating any digits is 0+4. Zero and four can't form a prime number, so the digital sum can't be 31. This leaves 17 and 23.

For the digital sum to be 17, the digits must be either 0+1+2+3+4+7 = 17 or 0+1+2+3+5+6 = 17. Only 0, 1, 2, 3, 4, 7 has both a 1 and 7 to make the last two digits be 17. However, there is no pair of remaining digits with a sum of 1+7 = 8, so the digital sum can't be 17 and therefore must be 23.

If the last two digits are 23, then the first two digits must total 2+3 = 5. The possibilities are 0+5 = 5 and 1+4 = 5. There is one prime number possible with each of these pairs: 05 and 41. The first two digits of the number can't be 05 because then the number would be a 5-digit number and Ralph's number has six digits. So the first two digits are 41 and the last two digits are 23.

Since the sum of all the digits is 23, then the sum of the middle two digits must be 23 - (2+3) - (4+1) = 13. There are two pairs of the remaining digits that total 13: 5+8 = 13, and 6+7 = 13. Sixty-seven is the only prime number that can be formed from these pairs, so the middle two digits are 67 and Ralph's number is 416723.