### Brain Teasers

# Rex and Ralph: Mystery Number

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.)

"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.)

### Hint

The digital sum is the sum of the digits in the number. The digital sum of 247 is 2+4+7 = 13.The digit pairs in 125690 are 12 56 90. These are also the numbers formed by the digit pairs.

Rotating 123456 one to the left gives 234561;

Rotating 123456 one to the right gives 612345;

Rotating the digit pairs in 567890 to the left gives 789056;

Rotating the digit pairs in 567890 to the right gives 905678.

### Answer

416723Here'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.

Hide Hint Show Hint Hide Answer Show Answer

## What Next?

**Solve a Similar Brain Teaser...**

Or, get a random brain teaser.

If you become a registered user you can vote on this brain teaser, keep track of

which ones you have seen, and even make your own.

## Comments

Excellent one. Really great...

Did your really think someone could follow that train of thought without a paycheck? I usually like all teasers, but this one was off the hook. But once I saw your train of thought and looked at the six digit number, which you led people to believe, the six digit number could have been any sic digits. I love Braingle. and you too. Good Teaser, boring but good, I hope you are truly good in math? You are not lying to us?

I think the train of thought in the teaser was easier to follow than your comment...did you have a point?

loved this one as well! Excellent thinking!

Wow. The train of thought ran right over me!

This seemed to be impossible at first, at least impossible to have a unique solution. It was amazing how as I worked on it the choices kept narrowing down. I thought this one was actually quite a bit easier than your Polygonal House teaser, probably because I got the "aha!" quicker on this one.

Another incredible teaser! Keep 'em coming!

How do you come up with these?

This seemed to be impossible at first, at least impossible to have a unique solution. It was amazing how as I worked on it the choices kept narrowing down. I thought this one was actually quite a bit easier than your Polygonal House teaser, probably because I got the "aha!" quicker on this one.

Another incredible teaser! Keep 'em coming!

How do you come up with these?

Thank you ron for the comment and complement!

When creating a teaser, first I try to find some interesting principle or quirk of math, probability or logic to exploit. Then I play around with different ideas using it until I find one I like. Then I try to (at least in the case of the Rex and Ralph teasers) determine what the minimum set of information will allow the solution to be determined. After I've worked out the math, at some point I get around to creating the teaser. I have about a dozen teasers right now where I've completed the math aspect, but just haven't had time to write a pleasing teaser around the math. In a few cases the teaser is written, but I haven't been able to simplify the explanation as much as I'd like.

I guess the main other "secret" to writing a good teaser is to be your own harshest critic. I discard most of my ideas and keep some around for a quite a while because they just don't feel right.

I know there's a large portion of the population on Braingle that won't ever appreciate my teasers because they require real effort, but I'm OK with that. I like them.

When creating a teaser, first I try to find some interesting principle or quirk of math, probability or logic to exploit. Then I play around with different ideas using it until I find one I like. Then I try to (at least in the case of the Rex and Ralph teasers) determine what the minimum set of information will allow the solution to be determined. After I've worked out the math, at some point I get around to creating the teaser. I have about a dozen teasers right now where I've completed the math aspect, but just haven't had time to write a pleasing teaser around the math. In a few cases the teaser is written, but I haven't been able to simplify the explanation as much as I'd like.

I guess the main other "secret" to writing a good teaser is to be your own harshest critic. I discard most of my ideas and keep some around for a quite a while because they just don't feel right.

I know there's a large portion of the population on Braingle that won't ever appreciate my teasers because they require real effort, but I'm OK with that. I like them.

Can't wait for the next one.

I can only really deeply appreciate all the thought going into those puzzles. I can solve them, but it is sooo much harder to come up with a good puzzle and construct an interesting story around it.

And don't worry about the community, there are enough of us loving these kind of puzzles.

I can only really deeply appreciate all the thought going into those puzzles. I can solve them, but it is sooo much harder to come up with a good puzzle and construct an interesting story around it.

And don't worry about the community, there are enough of us loving these kind of puzzles.

great work , but that suppose to have one solution i think it have more than one lets see

145823

that number is prime and all of your conditions approved

145823

that number is prime and all of your conditions approved

sorry u wrote "If each of the three numbers formed by the digit pairs in the number is prime, then what is the number?"

but i read each ( any) great puzzle thank u

but i read each ( any) great puzzle thank u

Great puzzle. I solved the puzzle slightly differnetly than the given solution. I assumed (and wrongly) that zero wasn't one of the answers. Turns out I still got the right answer and after a little thinking I figured out that my method would have still eliminated zero so its all good

I think this is the best puzzle where you have to figure out the number from clues about the digits. I love how at first it doesn't seem like there is enough information to arrive at a unique answer. I played around with the sum of the six numbers for a little bit before recognizing that each column in the sum contained the same set of digits. The Aha! moment was great!

Brilliant puzzle!

Brilliant puzzle!

I got 314113 (we'll call that number x)

digital sum (aka sum of digits or SOD) = last 2 digits : 13 = 13

SOD 1st 2 = SOD last 2 : 4 = 4

x rotated "a lot : 1444443

1st and last of "x rotated a lot" = last 2 digits of x : 13 = 13

Prime number digit pairs : 31, 41, and 13.

digital sum (aka sum of digits or SOD) = last 2 digits : 13 = 13

SOD 1st 2 = SOD last 2 : 4 = 4

x rotated "a lot : 1444443

1st and last of "x rotated a lot" = last 2 digits of x : 13 = 13

Prime number digit pairs : 31, 41, and 13.

continuation of above:

but the teaser was GREAT. i'd love to see more of these!

but the teaser was GREAT. i'd love to see more of these!

ric: Your answer doesn't meet the criteria "all digits are different".

This was an excellent one!

I seriously almost got it, but I came up with 430,217, and I thought I had it so I stopped looking. But I was overlooking that one little clue -- the sum of the first two digits is equal to the sum of the last two digits!

I seriously almost got it, but I came up with 430,217, and I thought I had it so I stopped looking. But I was overlooking that one little clue -- the sum of the first two digits is equal to the sum of the last two digits!

I got both 836129 and 416723

ScienceBlonde, 836129 doesn't satisfy the condition where the first and last digits of the sum of the six rotations matches the last two digits. The sum of the rotations is 32222219, and 39 is not the last two digits of 836129.

## Follow Braingle!