Skip to content

Instantly share code, notes, and snippets.

@ghabxph
Last active March 29, 2020 12:01
Show Gist options
  • Save ghabxph/ee39fc61b830596ce393e913e27a62d3 to your computer and use it in GitHub Desktop.
Save ghabxph/ee39fc61b830596ce393e913e27a62d3 to your computer and use it in GitHub Desktop.
Nice anti-boredom problem. And I'm bored, so I wrote this page. Shhh.

The problem

682 - One digit is right and in its place
614 - One digit is right but in the wrong place
206 - Two digits are right, but both are in the wrong place
738 - All digits are wrong
380 - One digit is right, but in the wrong place

My conclusion: 042 How?

Statement #4 gives us nice eliminations.

Now, keep these numbers in mind. Lots of things are confirmed right?

6 2 - One digit is right and in its place
614 - One digit is right but in the wrong place
206 - Two digits are right, but both are in the wrong place
    - All digits are wrong
  0 - One digit is right, but in the wrong place

Statement #1: (6 2) One digit is right and in its place

  • Statement 1.1. One digit is right (can be 6 or 2)
  • Statement 1.2. The right digit is in its place (6 on 1st place or 2 on 3rd position)

If 6 is our number, then 6 is key #1. If 2 is our number then 2 is key #3.

Let's move on.

Statement #2: (614) One digit is right but in the wrong place

Pick 6 as correct number, and go back to the rules.

  • Statement #1: (6 ) One digit is right and in its place
  • Statement #2: (6 ) One digit is right but in the wrong place (Contradiction)

Thus, 6 is eliminated by contradiction consequently giving us 2 as our key #3 (xx2).

At this point, either 1 or 4 is our possible key from statement #2.

  • If 1 is the right number, then 1 can only key #1, because key #3 is occupied by #2. (1x2)
  • If 4 is the right number, then 4 can be located either in 1st or 2nd position. (4x2, x42)

Let's move on.

Statement #3: (20 ) Two digits are right, but both are in the wrong place

0 can only be located in the 1st position, which consequently eliminates 1 in the process. 2 is known as key #3 (xx2), thus 0 can only be located at the first position (0x2), and consequently eliminates 1 in the process. Thus 4 can only be located in 2nd position, giving us a conclustion of 042 as our answer.

042 as our nice asnwer.

  • Statement #1 assures 2 in the 3rd position.
  • Statement #2 assures 4 in the 2nd position.
  • Statement #3 assures 0 in the first position.

EXTRA: Statement #5: ( 0) - One digit is right, but in the wrong place

Statement #5 is merely just a supporting statement. We can even eliminate this 5th statement and we still arrive to same conclusion that the answer is 042

@ghabxph
Copy link
Author

ghabxph commented Mar 29, 2020

Don't tell your friends the answer. Just keep this for yourself. Don't spoil the fun. :)

@ghabxph
Copy link
Author

ghabxph commented Mar 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment