5 Digit Code Puzzle
We have a 5 digit code, any place can take 1 2 or 3.
How do I find where the 2 is placed (if placed) knowing this criteria?
1) If the 1st digit is not a 3 then the 2nd is.
2) If the 1st digit is 3 then the 3rd digit is 2.
3) If 2nd digit is 3 and 4th is 2 then 5th is 1.
4) If the 3rd digit is not 2 then the 4th is 2.
5) If 3rd digit is not 2 then the 5th digit is not 1.
mathematics logical-deduction calculation-puzzle
New contributor
add a comment |
We have a 5 digit code, any place can take 1 2 or 3.
How do I find where the 2 is placed (if placed) knowing this criteria?
1) If the 1st digit is not a 3 then the 2nd is.
2) If the 1st digit is 3 then the 3rd digit is 2.
3) If 2nd digit is 3 and 4th is 2 then 5th is 1.
4) If the 3rd digit is not 2 then the 4th is 2.
5) If 3rd digit is not 2 then the 5th digit is not 1.
mathematics logical-deduction calculation-puzzle
New contributor
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
1
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40
add a comment |
We have a 5 digit code, any place can take 1 2 or 3.
How do I find where the 2 is placed (if placed) knowing this criteria?
1) If the 1st digit is not a 3 then the 2nd is.
2) If the 1st digit is 3 then the 3rd digit is 2.
3) If 2nd digit is 3 and 4th is 2 then 5th is 1.
4) If the 3rd digit is not 2 then the 4th is 2.
5) If 3rd digit is not 2 then the 5th digit is not 1.
mathematics logical-deduction calculation-puzzle
New contributor
We have a 5 digit code, any place can take 1 2 or 3.
How do I find where the 2 is placed (if placed) knowing this criteria?
1) If the 1st digit is not a 3 then the 2nd is.
2) If the 1st digit is 3 then the 3rd digit is 2.
3) If 2nd digit is 3 and 4th is 2 then 5th is 1.
4) If the 3rd digit is not 2 then the 4th is 2.
5) If 3rd digit is not 2 then the 5th digit is not 1.
mathematics logical-deduction calculation-puzzle
mathematics logical-deduction calculation-puzzle
New contributor
New contributor
edited Dec 15 at 16:22
JonMark Perry
17.1k63381
17.1k63381
New contributor
asked Dec 15 at 13:58
Agaeus
211
211
New contributor
New contributor
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
1
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40
add a comment |
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
1
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
1
1
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40
add a comment |
2 Answers
2
active
oldest
votes
The only thing we can say for sure is that
the $3^{rd}$ digit is a $2$. The other positions can be anything.
Proof:
If the $1^{st}$ digit is a $3$ then we are done.
If not, then digit:$2$ is a $3$. Now assume digit:$3$ is not a $2$, therefore digit:$4$ is a $2$ (by (4)), and so digit:$5$ is a $1$ (by (3)).
However (5) tells us that if digit:$2$=3 and digit:$4$=2, then digit:$5$ is not $1$, which is a contradiction, so digit:$3$=2.
For the other digit positions, these codes, $13231,23213,31211,32222$, contain a $1$, $2$ or $3$ in every other position.
Using some JavaScript:
s=;
for (a=1;a<4;a++)
for (b=1;b<4;b++)
for (c=1;c<4;c++)
for (d=1;d<4;d++)
for (e=1;e<4;e++) {
if (a!=3 && b!=3) continue;
if (a==3 && c!=2) continue;
if (b==3 && d==2 && e!=1) continue;
if (c!=2 && d!=2) continue;
if (c!=2 && e==1) continue;
s.push(''+a+b+c+d+e);
}
console.log(s);
we get:
$13211,13212,13213,13221,13231,\13232,13233,23211,23212,23213,\ 23221,23231,23232,23233,31211,\31212,31213,31221,31222,31223,\ 31231,31232,31233,32211,32212,\32213,32221,32222,32223,32231,\ 32232,32233,33211,33212,33213,\33221,33231,33232,33233$
which is $39$ codes in total.
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
add a comment |
Using the corrected program by @JonMarkPerry,
i.e. by changing if (c!=3 && d!=2) continue; to if (c!=2 && d!=2) continue;
We get
13211, 13212, 13213, 13221, 13231, 13232, 13233, 23211, 23212, 23213, 23221, 23231, 23232, 23233, 31211, 31212, 31213, 31221, 31222, 31223, 31231, 31232, 31233, 32211, 32212, 32213, 32221, 32222, 32223, 32231, 32232, 32233, 33211, 33212, 33213, 33221, 33231, 33232, 33233
Which means
the third position is always 2, and others may be also.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "559"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Agaeus is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f77488%2f5-digit-code-puzzle%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The only thing we can say for sure is that
the $3^{rd}$ digit is a $2$. The other positions can be anything.
Proof:
If the $1^{st}$ digit is a $3$ then we are done.
If not, then digit:$2$ is a $3$. Now assume digit:$3$ is not a $2$, therefore digit:$4$ is a $2$ (by (4)), and so digit:$5$ is a $1$ (by (3)).
However (5) tells us that if digit:$2$=3 and digit:$4$=2, then digit:$5$ is not $1$, which is a contradiction, so digit:$3$=2.
For the other digit positions, these codes, $13231,23213,31211,32222$, contain a $1$, $2$ or $3$ in every other position.
Using some JavaScript:
s=;
for (a=1;a<4;a++)
for (b=1;b<4;b++)
for (c=1;c<4;c++)
for (d=1;d<4;d++)
for (e=1;e<4;e++) {
if (a!=3 && b!=3) continue;
if (a==3 && c!=2) continue;
if (b==3 && d==2 && e!=1) continue;
if (c!=2 && d!=2) continue;
if (c!=2 && e==1) continue;
s.push(''+a+b+c+d+e);
}
console.log(s);
we get:
$13211,13212,13213,13221,13231,\13232,13233,23211,23212,23213,\ 23221,23231,23232,23233,31211,\31212,31213,31221,31222,31223,\ 31231,31232,31233,32211,32212,\32213,32221,32222,32223,32231,\ 32232,32233,33211,33212,33213,\33221,33231,33232,33233$
which is $39$ codes in total.
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
add a comment |
The only thing we can say for sure is that
the $3^{rd}$ digit is a $2$. The other positions can be anything.
Proof:
If the $1^{st}$ digit is a $3$ then we are done.
If not, then digit:$2$ is a $3$. Now assume digit:$3$ is not a $2$, therefore digit:$4$ is a $2$ (by (4)), and so digit:$5$ is a $1$ (by (3)).
However (5) tells us that if digit:$2$=3 and digit:$4$=2, then digit:$5$ is not $1$, which is a contradiction, so digit:$3$=2.
For the other digit positions, these codes, $13231,23213,31211,32222$, contain a $1$, $2$ or $3$ in every other position.
Using some JavaScript:
s=;
for (a=1;a<4;a++)
for (b=1;b<4;b++)
for (c=1;c<4;c++)
for (d=1;d<4;d++)
for (e=1;e<4;e++) {
if (a!=3 && b!=3) continue;
if (a==3 && c!=2) continue;
if (b==3 && d==2 && e!=1) continue;
if (c!=2 && d!=2) continue;
if (c!=2 && e==1) continue;
s.push(''+a+b+c+d+e);
}
console.log(s);
we get:
$13211,13212,13213,13221,13231,\13232,13233,23211,23212,23213,\ 23221,23231,23232,23233,31211,\31212,31213,31221,31222,31223,\ 31231,31232,31233,32211,32212,\32213,32221,32222,32223,32231,\ 32232,32233,33211,33212,33213,\33221,33231,33232,33233$
which is $39$ codes in total.
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
add a comment |
The only thing we can say for sure is that
the $3^{rd}$ digit is a $2$. The other positions can be anything.
Proof:
If the $1^{st}$ digit is a $3$ then we are done.
If not, then digit:$2$ is a $3$. Now assume digit:$3$ is not a $2$, therefore digit:$4$ is a $2$ (by (4)), and so digit:$5$ is a $1$ (by (3)).
However (5) tells us that if digit:$2$=3 and digit:$4$=2, then digit:$5$ is not $1$, which is a contradiction, so digit:$3$=2.
For the other digit positions, these codes, $13231,23213,31211,32222$, contain a $1$, $2$ or $3$ in every other position.
Using some JavaScript:
s=;
for (a=1;a<4;a++)
for (b=1;b<4;b++)
for (c=1;c<4;c++)
for (d=1;d<4;d++)
for (e=1;e<4;e++) {
if (a!=3 && b!=3) continue;
if (a==3 && c!=2) continue;
if (b==3 && d==2 && e!=1) continue;
if (c!=2 && d!=2) continue;
if (c!=2 && e==1) continue;
s.push(''+a+b+c+d+e);
}
console.log(s);
we get:
$13211,13212,13213,13221,13231,\13232,13233,23211,23212,23213,\ 23221,23231,23232,23233,31211,\31212,31213,31221,31222,31223,\ 31231,31232,31233,32211,32212,\32213,32221,32222,32223,32231,\ 32232,32233,33211,33212,33213,\33221,33231,33232,33233$
which is $39$ codes in total.
The only thing we can say for sure is that
the $3^{rd}$ digit is a $2$. The other positions can be anything.
Proof:
If the $1^{st}$ digit is a $3$ then we are done.
If not, then digit:$2$ is a $3$. Now assume digit:$3$ is not a $2$, therefore digit:$4$ is a $2$ (by (4)), and so digit:$5$ is a $1$ (by (3)).
However (5) tells us that if digit:$2$=3 and digit:$4$=2, then digit:$5$ is not $1$, which is a contradiction, so digit:$3$=2.
For the other digit positions, these codes, $13231,23213,31211,32222$, contain a $1$, $2$ or $3$ in every other position.
Using some JavaScript:
s=;
for (a=1;a<4;a++)
for (b=1;b<4;b++)
for (c=1;c<4;c++)
for (d=1;d<4;d++)
for (e=1;e<4;e++) {
if (a!=3 && b!=3) continue;
if (a==3 && c!=2) continue;
if (b==3 && d==2 && e!=1) continue;
if (c!=2 && d!=2) continue;
if (c!=2 && e==1) continue;
s.push(''+a+b+c+d+e);
}
console.log(s);
we get:
$13211,13212,13213,13221,13231,\13232,13233,23211,23212,23213,\ 23221,23231,23232,23233,31211,\31212,31213,31221,31222,31223,\ 31231,31232,31233,32211,32212,\32213,32221,32222,32223,32231,\ 32232,32233,33211,33212,33213,\33221,33231,33232,33233$
which is $39$ codes in total.
edited Dec 15 at 18:44
answered Dec 15 at 16:11
JonMark Perry
17.1k63381
17.1k63381
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
add a comment |
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
You mean rot13("vs gur svefg qvtvg vf guerr") at the start of the proof? May I also suggest putting the proof first, then picking two examples to show rot13(gjb pna nyfb tb va nal bgure cbfvgvba), then the program as a postscript.
– deep thought
Dec 15 at 18:26
add a comment |
Using the corrected program by @JonMarkPerry,
i.e. by changing if (c!=3 && d!=2) continue; to if (c!=2 && d!=2) continue;
We get
13211, 13212, 13213, 13221, 13231, 13232, 13233, 23211, 23212, 23213, 23221, 23231, 23232, 23233, 31211, 31212, 31213, 31221, 31222, 31223, 31231, 31232, 31233, 32211, 32212, 32213, 32221, 32222, 32223, 32231, 32232, 32233, 33211, 33212, 33213, 33221, 33231, 33232, 33233
Which means
the third position is always 2, and others may be also.
add a comment |
Using the corrected program by @JonMarkPerry,
i.e. by changing if (c!=3 && d!=2) continue; to if (c!=2 && d!=2) continue;
We get
13211, 13212, 13213, 13221, 13231, 13232, 13233, 23211, 23212, 23213, 23221, 23231, 23232, 23233, 31211, 31212, 31213, 31221, 31222, 31223, 31231, 31232, 31233, 32211, 32212, 32213, 32221, 32222, 32223, 32231, 32232, 32233, 33211, 33212, 33213, 33221, 33231, 33232, 33233
Which means
the third position is always 2, and others may be also.
add a comment |
Using the corrected program by @JonMarkPerry,
i.e. by changing if (c!=3 && d!=2) continue; to if (c!=2 && d!=2) continue;
We get
13211, 13212, 13213, 13221, 13231, 13232, 13233, 23211, 23212, 23213, 23221, 23231, 23232, 23233, 31211, 31212, 31213, 31221, 31222, 31223, 31231, 31232, 31233, 32211, 32212, 32213, 32221, 32222, 32223, 32231, 32232, 32233, 33211, 33212, 33213, 33221, 33231, 33232, 33233
Which means
the third position is always 2, and others may be also.
Using the corrected program by @JonMarkPerry,
i.e. by changing if (c!=3 && d!=2) continue; to if (c!=2 && d!=2) continue;
We get
13211, 13212, 13213, 13221, 13231, 13232, 13233, 23211, 23212, 23213, 23221, 23231, 23232, 23233, 31211, 31212, 31213, 31221, 31222, 31223, 31231, 31232, 31233, 32211, 32212, 32213, 32221, 32222, 32223, 32231, 32232, 32233, 33211, 33212, 33213, 33221, 33231, 33232, 33233
Which means
the third position is always 2, and others may be also.
answered Dec 15 at 16:59
SteveV
5,0502628
5,0502628
add a comment |
add a comment |
Agaeus is a new contributor. Be nice, and check out our Code of Conduct.
Agaeus is a new contributor. Be nice, and check out our Code of Conduct.
Agaeus is a new contributor. Be nice, and check out our Code of Conduct.
Agaeus is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Puzzling Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f77488%2f5-digit-code-puzzle%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Welcome to Puzzling! Where is the source of this puzzle? Please note that questions from other places must be credited correctly (and make sure you have permission to use them!)
– Deusovi♦
Dec 15 at 14:04
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
– Agaeus
Dec 15 at 14:13
1
May I suggest using the letters A,B and C instead of numbers for the code, that would make them a lot easier to distinguish from the ubiquitous "Nth digit" numbers.
– Bass
Dec 15 at 16:57
I think real answer is: Any place!! ;).
– shA.t
Dec 16 at 12:40