# Find the 8-digit number

A secret number has each one of its 8 digits colored either blue or red. Here are some clues:

1. All digits from 1 to 8 appear in the number.

2. The first two digits are not consecutive.

3. The last three digits are odd.

4. The number of blue digits appears at one of the middle two digits.

5. The third digit is twice as large as one of the last three digits.

6. The fourth digit is twice as large as the sixth digit.

7. Every red digit points to the position of a blue digit.

8. Every blue digit points to the position of a red digit.

9. The fourth digit is greater than the third.

10. The last digit is blue.

Find the secret number and the colors of its digits.

(Here is a small example that might clarify some wording: In the number 41523, the 4 is the first digit and points to 2 which is the fourth digit.)

Let's try to find the sequence first. Clues 1, 2, 3, 5, and 9 do this, while 4 is a combination.

Clue #3 indicates that only one of the first five is odd. Digits 3 and 4 are even and since the fourth is greater than the third the sixth digit is greater than one of the seventh or eighth. Also note that 1 and 3 are the only odd digits that can be multiplied by 2 to get something 1-8, so digit 4 is 6 and digit 3 is 2. So the sixth digit is 3. So far:

_ _ 2 6 _ 3 _ _

By clue two the first two digits aren't consecutive.

Since all red digits point to a blue digit and all blues point to red there must be 4 blues and 4 reds. This makes one of the middle digits a 4, specifically the 5th one. The remaining digits are 1, 5, 7, and 8, but since 1 is the 7th or 8th and 8 is one of the first two the digit 5 is part of the first two digits.

So the possible cases are:

58264317 85264317 58264371 85264371

Note that the last two cases are gone since 7 can't be red and blue. And the second case is a 3-way loop and a 5-way (8->7->1) which is invalid, so the sequence is:

58264317

By simple coloring the colors are either

RBRRBBBR or BRBBRRRB

By the final clue it's the second.

So it's

58264317 and BRBBRRRB

58264317
BRBBRRRB

With the second row denoting the order of red/blue numbers.

Solution:
Using clue #3 we can conclude that

#1 -
#2 -
#3 -
#4 -
#5 -
#6 1,3,5,7
#7 1,3,5,7
#8 1,3,5,7

Clues #5 and #6 tell us that digit 3 and 4 are twice the size of numbers in 6, 7, 8; this means that they are either 2 or 6 (1*2 and 3*2; 5*2 and 7*2 are obviously too large). Combine this with clue #9 saying that digit 4 is greater than digit 3, tells us which is 2 and which is 6. We use clue #6 as well; digit 4 is twice the size of digit 6.

#1 -
#2 -
#3 2
#4 6
#5 -
#6 3
#7 1,5,7
#8 1,5,7

We can note that since we have digit 3, we know that the number half that size has to be one of digits 7 or 8.
Now we'll do some preparation to solve digit 5. Clues 7 and 8 tell us that blue digits point to red digits and vice versa. This means that half the numbers must be blue. If there is an odd number, we are left with an impossible loop; let's say three numbers point to eachother in a loop and we have the alternate colors rule. Digit 1 is blue and points to digit 2. Digit 2 is therefore red. Digit 2 points to digit 3. Digit 3 is therefore blue. Digit 3 points to digit 1. Digit 1 is therefore red. Digit 1 is now defined as both red and blue, which is not an option. Because of this, we can conclude that the number of blue numbers if 4. Rule 4 tells us that this number must be on of digits 4 or 5. We have already solved 4, thus the number 4 is digit 5.

#1 -
#2 -
#3 2
#4 6
#5 4
#6 3
#7 1,5,7
#8 1,5,7

Now, let's look at digits 1 and 2. If we exclude the solved numbers as well as the number one (since one has to be either digit 7 or 8 as our reasoning a couple of paragraphs above show), the possibles we are left with are 5,7,8. Rule 2 states that these numbers cannot be consecutive, having them as the pair 7 and 8 isn't possible. Therefore at least one of them must be the remaining option, 5. We can now exclude 5 as a possible for digits 7 and 8 which means that our previous 1,5,7 options are now reduced to 1,7. That means one of them has to be 7, excluding 7 as an option for digits 1 and 2. This leavus with:

#1 5,8
#2 5,8
#3 2
#4 6
#5 4
#6 3
#7 1,7
#8 1,7

Digit 7 has the options 1,7. If digit 7 has the number 7, it points to itself; since colors have to alternate, this is not a valid option, solving digit 7 and therefore also digit 8.

#1 5,8
#2 5,8
#3 2
#4 6
#5 4
#6 3
#7 1
#8 7

I'll use the format dx->dy to illustrate a chain of digits. This means "digit x has the number that points to digit y". Refer back to the previous table to evaluate and compare.
d8->d7->d1
Digit 1 contains either 5 or 8; if it contains 8, the chain will loop:
d8->d7->d1->d8->..
This chain is 3 digits long, and will therefore break the alternating colors rule! 8 can therefore be excluded as an option for digit 1. All the numbers are now solved.

#1 5
#2 8
#3 2
#4 6
#5 4
#6 3
#7 1
#8 7

58264317

To find the colors of the letters, simply use rule #10 and follow the chain.

8R, 7B, 1R, 5B, 4R, 6B, 3R, 2B

As always I leave a left solution in order to make the reasoning in each step elaborate for the sake of understanding. Hope that is of some value.

I come up with some possible numbers While I have the same reasoning as pie's first half, I do not see why

"This makes one of the middle digits a 4"

Instead, I went a easy way by

creating two 2-way loops and one 4-way loop
after all, "Every red digit points to the position of a blue digit" and "Every blue digit points to the position of a red digit"
do not necessarily entails that the digits must form a 8-way loop

So, starting from the deduction step: XX26X3XX
I just try to fitting the remaining slots with the remaining digits

which also fits the criteria.

• There are 4 blue digits, so 4 must appear in the middle. It cannot be in the 4th position, since then it would point to itself, so it must be in spot #5. – Klyzx Mar 1 '17 at 3:16
• You do not see why one of the middle digits must be a 4?  Did you miss clue #4: “The number of blue digits appears at one of the middle two digits”? And 4 can’t be the fourth digit, because that is 2 × an odd number. – Peregrine Rook Mar 1 '17 at 3:36
• o, i mistaken #4 as "there is a blue digit in the middle 2 digits", haha ^_^" – Joe Mar 1 '17 at 9:09

5 8 2 6 4 3 1 7

Rule 5 and rule 6 are the best starting point. Digit 3 is 2x one of the last 3, whilst digit 4 is 2x the 4th digit.

If the last 3 are all odd, we can deduce that the last 3 are from 1, 3, 5 and 7. For digit 3 to be 2x one of these numbers, digit 3 must be either 2 or 6.

_ _ 2 _ _ _ _ _ or _ _ 6 _ _ _ _ _

Now, the 4th digit is 2x the 6th digit (Which is one of the last 3). This means that digit 4 must be the other of 2 and 6.

_ _ 2 6 _ _ _ _ or _ _ 6 2 _ _ _ _

Now we know that digit 6 is either 1 or 3

_ _ 2 6 _ 3 _ _ or _ _ 6 2 _ 1 _ _

Next, rule 9, the 4th digit is greater than the third.

This means that it must _ _ 2 6 _ 3 _ _

If every red digit points to a blue digit and vice versa, there has to be an equal amount of each.

8/2 = 4, so if 4 is one of the 2 middle digits (4th or 5th), but we know

the 4th is 6, then that gives us _ _ 2 6 4 3 _ _

Since 7 and 8 are consecutive numbers, and 8 must be one of the first 2 digits, we know that 7 is one of the last 2.

_ _ 2 6 4 3 7 _ or _ _ 2 6 4 3 _ 7

Digit 8 is blue, which points a red digit. Going by the assumption of the second scenario being correct, 7 is blue, so digit 7 must be red. We know digit 7 must now either be 1, or 5.

_ _ 2 6 4 3 1 7 or _ _ 2 6 4 3 5 7

This would mean

7 is blue, 1 is red, then digit 1 is blue. Digit 1 can now longer be 8, since that would loop back to the 7, 1, 8 pattern, meaning

digit 1 must be 5; 5 8 2 6 4 3 1 7 = B R B B R R RB

This gives 4 of each colour, in a pattern to match the rules.

• Thanks for the solution. Your answer at the top is different from your final conclusion. – Alexandros Mar 2 '17 at 0:09
• @Alexandros Oops, my bad, I got the top answer initially then realised when typing the answer it was wrong and forgot to change it at the top! – David Mar 3 '17 at 9:19

I also do not see why

"This makes one of the middle digits a 4"

and my conclusion:

1. clue 3,5 => third 2 or 6
2. clue 3,6 => fourth 2 or 6, sixth 1 or 3
3. clue above,9 => third 2 fourth 6, sixth 3, and position 7 or 8 must be 1
4. clue 7,8 =>4 digits in red, 4 in blue, and first can't be 1, second can't be 2....
Then I assume the position 8 is digit 1, the answer goes like this
RBRRBBRB 84267351

Am i wrong or missing some clues?

• An explanation for this has already been given in one of the comments to Joe's answer: clue #4 tells us that the number of blue digits appears at one of the middle two digits. Since that number is '4', it can't appear in the second position, like in your answer. – Levieux Mar 1 '17 at 8:29
• @Levieux yes,you're right,and I misunderstand "The number of blue digits appears at one of the middle two digits." as "The number of blue digits appears at one of the middle two positions..." – jackie chen Mar 1 '17 at 8:54