# House Number Mastermind

I was having a house-leaving party at my old house, and challenged four of my friends to guess the number of the new address, which had three digits.

The responses I got were 280, 376, 304, and 370.

I was amused, as each one of them got one digit correctly and in its right place, while the other two digits of each guess did not match in any place.

What's my house number?

• and none of them got the right number? – skv Oct 23 '14 at 13:03
• Yes, none of them got it exactly right, but they did get one digit. – generalcrispy Oct 23 '14 at 13:21
• Don't $381$, $385$, and $389$ also work? – user3294068 Oct 23 '14 at 15:21
• I'm slightly concerned that none of your guests who have just walked into your new house to a party can remember what number house they just came to – Joe Oct 23 '14 at 16:06
• @Joe I often forget my friends' house numbers; I know where the house is, so I usually don't need them! – TheRubberDuck Oct 23 '14 at 17:19

274

376 and 370 must share one number and not another.

based on possibilities of first number and can't be three or the last number would be repeated twice in one of them.

seeing as 3 isn't the first number 7 must be the second number because of 376 and 370.

can't be 6 or 0 for the third number or else there would be two numbers with 2 correct guesses so that leaves 4.

• I'm not sure what you're trying to say about 3 not being first. $38x$ is valid for $x \in \{1, 5, 9\}$. – Kevin Oct 23 '14 at 16:28
• Yes, assuming "What's my house number" means, you have all the numbers provided thus 1,5,9 are not in the set available. Otherwise if he asked what are the possibilities of my house number then you'd be correct and 381,385, and 389 would be acceptable. – Bozman Oct 23 '14 at 17:04

I see no unique solution for this: Unless you assume the solution must uniquely defined by the information given. (Or hopefully simpler terms all the numbers appear in the correct position in the responses.)

Naming the friends A,B,C,D gives A: 280, B: 376 , C: 304 , D: 370

Position 1 has possibilities 2,3,3,3

Assuming 3 is right leads to no unique solution...

- B,C,D all have now have exactly one match
- For a match from A either position 3 is 0 or position 2 is 8
- Position 3 cannot be 0 as D has this and has already got 1 position correct
- So position 2 is 8
- The solution is 28x (where x is unknown)
- As no 3rd digit can be right x cannot be 0,4,6

There are many possible solutions: 381, 382, 383, 385, 387, 388, 389

By assuming a solution must contain only position-number pairs present in the given responses we can now say position 1 cannot be 3. This is because the solutions above do not satisfy this as none of the solutions contains a number in the 3rd position which is in the 3rd position of a response...

So in position 1 A must be right with a value of 2,

- Position 2 can be one of 7,0,7 (B, C, D)
- If 0 is right A and C have exactly 1 right
- There are now no matches in either B or D thus there is no solution as one of B and D will have no match.
- Therefore in the 2nd position 7 is right and A,B and D have exactly 1 match so position 3 must be given by C.

Leading to the unique solution 274

• Another way to break it down, good answer. – generalcrispy Oct 23 '14 at 14:11
• @generalcrispy You can add to the question that no three of them got the digit correct at the same position to eliminate the first case. – justhalf Oct 24 '14 at 6:38
• @justhalf I just made an edit giving an alternate wording which would also lead to the first case being eliminated: all of the digits appear correctly in the correct place in the responses. – RTL Oct 24 '14 at 13:46

Let's say the number is ABC and let's pick 376 as our starting point.

Case 1: C = 6

376 => A != 3 and B !=7
370 => A == 3 or B == 7


Contradiction, so C cannot be 6

Case 2: B = 7

304 => A == 3 or C == 4
376 => A != 3 and C != 6
=> C = 4

280 => A == 2


Solution: 274

Case 3: A = 3

280 => B == 8 or C == 0
370 => B != 7 and C != 0
=> B = 8

280 => C != 2 and C != 8 and C != 0
370 => C != 3 and C != 7 and C != 0
376 => C != 3 and C != 7 and C != 6
304 => C != 3 and C != 0 and C != 4
=> C in [1, 5, 9]


Solution: 381, 385, 389

• Case 2 brings up the correct solution, but case 3 brings up 3 more valid solutions. Could you suggest a condition to be added to the puzzle that will eliminate this case? – generalcrispy Oct 23 '14 at 16:48
• I assumed that each position was guessed completely once base don the fact that you assumed we could guess your house. Otherwise the final question would have been either how many and which houses would you have to check at most before finding my house. – Bozman Oct 23 '14 at 17:07
• @generalcrispy You could add another person who guesses 134 for example. That would eliminate all the last 3 solutions while still preserving 274. – Tibos Oct 24 '14 at 8:24

The answer would be 274. That is what would give each one a correct digit in one spot

to get a unique answer each set has 1 correct digit in the correct spot. 4 answers 3 digits means no more than 2 digits in the same spot can be correct. so in the first spot we can have a 2 or 3, since there are 3 - 3's it must be a 2.

so for the remaining 2 digits we have

76, 04, 70

2 of these are going to have the same correct digit in the correct spot, 0 and 7 are the duplicate digits, 0 is in 2 different spots and 7 is in the same spot, this means 7 is the second digit, 27, all that is left is 4 to complete it 274.

If the first digit is 3 (satisfies the 2nd, 3rd and 4th guesser) and the second digit is 8 (satisfies the 1st), then the third digit can be anything apart from 0, 4 or 6 (as they have each only got one correct digit).

So some possible answers are 381, 382, 383, 385, 387, 388, 389.

• each set has only 1 correct digit, so any digit that is repeated more than 2 times is an incorrect digit. – bowlturner Oct 23 '14 at 13:13
• "one digit correctly and in its right place" - to me this means "one digit that is both correct and in its right place", ie their other digits fail one of these two criteria. – fightingirish Oct 23 '14 at 13:19
• yes, in each group of 3 digits, 1 of those digits is correct and it is in the right place. so you need to find 3 different digits from all 4 groups that align. Read Bozman's answer it might help. – bowlturner Oct 23 '14 at 13:28
• So what about what you just said makes my answer incorrect? There are 4 groups of 3 digits. Each group is satisfied by my answer because it has "1 of those digits is correct and it is in the right place" – fightingirish Oct 23 '14 at 13:35
• "What's my house number?" implies there is only one correct answer and you gave 7 possible answers. The idea then is that each one of the 3 different digits needed for the house number is present in the 4 answers. – bowlturner Oct 23 '14 at 13:42

First number can be 3 or 2.

If it's 3, 3rd digit can't be 0, 4 or 6, so the 2nd digit must be 8. As 38x satisfies the condition for all guesses, then the 3rd digit can't be any of the already used numbers (0, 2, 3, 4, 6, 7 or 8).

If first digit is 2, because of 370 and 376, 2nd digit must then be 7, and because of 304, the 3rd one 4.

274, 381, 385 and 389.

• In the $38x$ numbers, the last digit can't appear in any position in any of the given numbers, so only 1, 5, and 9 work. – Kevin Oct 23 '14 at 16:32

What a cool party game idea!! This is actually a game I made up for myself as a kid and programmed it into various programming languages as I grew up and now it's something my 12 year old son and I have been playing with each other for a few years.

Since we know that all of the digits in the address are represented in the four guesses, it makes solving this pretty simple.

1. because 0 swapped places in 2 guesses and the result of the guess was the same (1 digit correct and in the right pos), you can eliminate 0 from the answer.

2. because 0 is eliminated it leaves 3 pairs of numbers where only one of the numbers is in the answer. (28_, 37_, and 3_4) because of this result you can eliminate 6 as a correct digit because of the guess using 3, 7, and 6 together and getting the (1 and 1) result we know that only the 3 or the 7 is correct so far.

3. because 4 is the only digit left in the last pos (after our eliminations) it must be the correct digit. allowing us to eliminate 3 as a correct digit because of the guess using 3, 0, and 4 and getting (1 and 1) result and having already eliminated 0.

4. once 3 is eliminated it leaves 7 as the only possible correct digit for the 2nd position, and therefore eliminating 8 from the correct answer which at the same time leaves 2 as the only possible digit in the first pos.

274 is the only remaining guess and as my son would say "Ding ding ding! you got 3 right and 3 in the right place!"

• That makes me very happy to hear. – generalcrispy Jul 14 '15 at 20:40

274.

Because:

The first digit isn't $$3$$, otherwise the remaining two digits must come from $$280$$, so it's $$2$$. From $$280$$, $$0$$ isn't the last digit, so the correct digit in $$370$$ is $$7$$, and as $$376$$ already has it's correct digit, the last digit is from $$304$$, and is $$4$$.

274, if i choose 2 as first digit then 280 is out from given number. next is 7, then 376,370 is out from given number. 304 is left and i choose 4 from them. so House number would be 274.