# 5-digit puzzle code looking for solution

Can somebody help me solve this, or can you teach me how?

4 7 2 9 1 - One number is correct but not in right position
9 4 6 8 7 - One number is correct but not in right position
3 1 8 7 2 - Two numbers are correct but only one is in right position
1 5 7 3 9 - Two numbers are correct and both in right position

• Hi, welcome to Puzzling.SE! Where does this puzzle come from? If someone else made it, you need to provide a link back to wherever you found it. Apr 12, 2020 at 11:57
• its a game from my boss dont know where he get it,, so im asking someone to solve it.really got headache solving this Apr 12, 2020 at 12:06
• we did came up with the same answer.. hope its correct. thank u very much Apr 13, 2020 at 12:32
• If Oray's answer does turn out to be correct, you can mark it as correct by clicking the green tick mark next to his answer. If it isn't, but your boss tells you the correct solution, you can post that as an answer yourself. Apr 13, 2020 at 12:34
• still waiting for his comment on my answer Apr 13, 2020 at 12:49

65032

because

I believe your boss' intention was using every digit only once even though it was not given.

Otherwise, there are lots of answers.

How I solved;

Assuming

Every digit needs to be used only once

First two 5 digit numbers (guesses)

have 3 digits in common, so I eliminate them first: $$9$$,$$7$$,$$4$$. The reason is that if we choose any one these digits, we need to eliminate at least 6 numbers directly: $$1$$,$$2$$,$$6$$,$$8$$ and two more numbers among the ones I eliminated. So it should not be the case.

Then

I choose couple from the first wo digit numbers with the left digits, and at the end of trial and error I found the answer after like a minute. (such as {1,8} {1,6}, {2,8}, {2,6}).

I assumed positive digits only and did not consider a zero (not shown as in use).

1. 7 is absent. It would contribute 4 to the total score of 6 requiring either 5 or 6 (which appear only once) clashing with Guess 3, or 2, 3, 4 or 8 padding with repeats. All these lead to contradictions when present with 7.

2. 9 is absent. It would contribute 3 to the total. It needs 4, 7, 2, 1, 6, 8 to be absent and either 3 or 5 to be present. 3 would need a unipresent digit (only 5, 6 available), so 5, as 6 absent. The digits appearing twice are 2,3,4 and 8 forcing 3 (others absent) and a bust score of 3 on Guess 4. Similarly 5 would need a 3, bust score again.

3. Of the 10 combo's for guess 4, seven use 7 or 9. We are left with

(a) 1 and 5.
(b) 1 and 3 (immediate clash between G3 and G4).
(c) 5 and 3.

We can't have all three of them (bust on G4). We'll look at (c) first. 1, 7, 9 are absent (G4); 3 is a white peg (wrong place) in G3, so 2 or 8 is black (in position) in G3. 2 or 4 is present in G1, and 4, 6 or 8 is present in G2. If 2, then 6. If 8, then 4 (since ~2) scoring 2 for G2 bust =x=. So 2 is in 1st place and 6 is in 5th place. Two solutions, 65332 and 65532.

Now (a). 7, 3, 9 absent. In G3, 1 is white so black options are 8, 7 or 2.Not 7 (since in D, sated). Not 2 (absent, as G1 scores from the 1).Must be 8. Then 9, 4, 6, 7 absent (G2). So 2, 3, 4, 6, 7, 9 absent leaving 1, 5, 8 in first 3 places. 1 or 5 in 4th place and 5 or 8 in 5th place. Four solutions. 15815, 15818, 15855, 15858.

All six solutions involve repeats, which the setter didn't exclude. Goodness knows how many if zeroes are allowed. Not the most elegant of puzzles but I got some enjoyment.

• Whoops, I meant 2 in 5th place and 6 in 1st Mar 2, 2021 at 23:16
• And D means Guess 4. Mar 2, 2021 at 23:16
• Instead of noting mis-types in comments below your answer, I encourage you to edit your answer for clarity. Also, as you can see in the other answer, 65032 is a possible solution. I'm not sure why it ended up being excluded from your solutions. Mar 3, 2021 at 0:11