Code puzzle thread +_+

Kyriakos

Creator
Joined
Oct 15, 2003
Messages
75,899
Location
The Dream
This is a thread where code puzzles (with digits) can be posted. Whoever solves the current puzzle can post the next. If a week passes without a solution, the presenter of the puzzle it has to provide one.
If others didn't solve it, open floor is declared, unless there's a consensus to give it to the person that made the most progress :yup:

Let's start with this:

1721648736233.png


1) The correct answer is a 4 digit pin.
2) In each of the six sets above, there is only one correct digit in the correct position (careful: there can be an unknown number of correct digits in false positions).
3)The correct pin doesn't have any digit repeat itself.

This puzzle has a single solution.

You can thank @Arakhor , as patron of the thread in the subforum. But for related reasons he is excused from solving this first one.

As it is a new thread, allow me to summon a few people who may or may not be interested: @Gori the Grey , @Gorbles , @Samson , @EvaDK , @Bonyduck Campersang, @red_elk , @REDY , @The_J , @Takhisis . I will think of more later :S
 
Last edited:
Looks to me like the secret here is

Spoiler :
The digit that appears in the same spot twice is the one in the right spot
Definitely about the main part of the opening trick, though not quite correct as you worded it :D
Hint, related to your spoiler:
Spoiler :
notice how many digits are repeated in a spot, how many given cases with one correct spot you have, and how many spots there are in a true pin=solution

Can you try solving?
 
Last edited:
As it is a new thread, allow me to summon a few people who may or may not be interested: @Gori the Grey , @Gorbles , @Samson , @EvaDK , @Bonyduck Campersang , @Lexicus , @REDY . I will think of more later :S
You tagged me, but I'm only seeing this thread now. Maybe tagging users in an edit doesn't send them a notification?
 
Definitely about the main part of the opening trick, though not quite correct as you worded it :D
Hint, related to your spoiler:
Spoiler :
notice how many digits are repeated in a spot, how many given cases with one correct spot you have, and how many spots there are in a true pin=solution

Can you try solving?

Actually my formula didn't work. I got 7328 but two of the lines would have multiple correct.
 
Actually my formula didn't work. I got 7328 but two of the lines would have 2 correct.
Yes, that's not the correct pin :)
But you can, if you feel like it, rework your method using also my reply to you in the spoiler! You did get the gist of what was going on in the opening move, just not the full strategy of it.
 
I'll put it in spoilers so others can still try to solve it.

Spoiler :
I knew the duplicates had to be a hint because there were six numbers listed. I got stuck trying to start with "If the first digit is 7", so I went to the second digit. 3 was listed twice. If that's correct, the first can't be 7 because of 7358 or 9 because of 9307. Knocking out 7 also meant 7 wasn't the correct digit in 7628, so either the 2 or 8 was correct. That really narrowed it down. If the 8 is correct 7358 has two correct digits. So it's 432X. 1191 doesn't have a correct digit yet and the last digit is the only one still unsolved.
 
And since we do have an answer anyway, let me explain what the pigeonhole principle is, since it was needed here.

Explanation (with example) of the Pigeonhole Principle

Say you have 3 papers. And you can write in those 3 papers either the number 1 or 2. Regardless of what you write, since the set of numbers is smaller (contains only two members: 1,2) than the number of cases of written numbers (which are 3), you already know that there will be at the very least one repetition of a number, ie you will end up with two 1s or two 2s. Of course you can also end up with 3 1's (and no 2s) or 3 2's (and no 1s).
Likewise, when you have 6 cases of one correct digit/location, but only 4 correct digits, you already know that in the cases you have at least a correct digit/location repeated. It could have been that one digit was there 3 times, or that two digits were there 2 times. And by the examples given in the puzzle, you observe that no digit was there 3 times in the same position, while there are four digits (8,7,3,2) that are there two times in a position => out of the group (8,7,3,2) there are two numbers in the correct pin.
I will post the full solution later on :)
 
I'll put it in spoilers so others can still try to solve it.

Spoiler :
I knew the duplicates had to be a hint because there were six numbers listed. I got stuck trying to start with "If the first digit is 7", so I went to the second digit. 3 was listed twice. If that's correct, the first can't be 7 because of 7358 or 9 because of 9307. Knocking out 7 also meant 7 wasn't the correct digit in 7628, so either the 2 or 8 was correct. That really narrowed it down. If the 8 is correct 7358 has two correct digits. So it's 432X. 1191 doesn't have a correct digit yet and the last digit is the only one still unsolved.
Yes, that is just fine, well done :D

What follows is my solution (it's just more detailed, but overall the same)

Spoiler :

A)There are six appearances of a correct number in correct position, but only four such numbers, consequently either one correct position appears thrice or two correct positions appear twice. We see that no position actually appears thrice in different attempts. (this is called the pigeonhole principle, when you have more cases than the full number of different possibilities; eg in a set of more that 365 random days, you know that at least one calendar day has been repeated)
B)We know that the only numbers/positions repeated are 7 (first position), 3 (second), 2 (third) and 8 (fourth), and so two of those four are in the pin in those positions. Since there is at most one out of 7,8 (as they appear in two different sets in the same positions), we know that there is at least one there from 3,2.
C)We assume that 8 is repeated in the pin in the last position. Then it'd follow from the set 7358, that 3 can't be repeated (since it can't be in a correct position as second) and also that 2 has to be repeated (because we established in B' that either 3 or 2 must be), but this is clearly false as then in set 7628 we would have two correct positions in 2 and 8. Consequently 8 isn't last and is not repeated. From the same set 7628 and for the same reason it follows that if 7 is repeated then 2 can't be, but then due to set 7358 3 can't either, which means that 7 isn't repeated and thus 3 and 2 are, with 3 in second position and 2 in third.
D)From C' and the set 1191 it follows that 1 is either in the first or last position. But from set 4882 it can only be that 4 is in the correct position. Therefore the pin has to be 4321.
 
Last edited:
Top Bottom