5 Digit Code Puzzle












4












$begingroup$


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.











share|improve this question











$endgroup$












  • $begingroup$
    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!)
    $endgroup$
    – Deusovi
    Dec 15 '18 at 14:04










  • $begingroup$
    Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
    $endgroup$
    – Agaeus
    Dec 15 '18 at 14:13






  • 1




    $begingroup$
    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.
    $endgroup$
    – Bass
    Dec 15 '18 at 16:57










  • $begingroup$
    I think real answer is: Any place!! ;).
    $endgroup$
    – shA.t
    Dec 16 '18 at 12:40
















4












$begingroup$


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.











share|improve this question











$endgroup$












  • $begingroup$
    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!)
    $endgroup$
    – Deusovi
    Dec 15 '18 at 14:04










  • $begingroup$
    Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
    $endgroup$
    – Agaeus
    Dec 15 '18 at 14:13






  • 1




    $begingroup$
    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.
    $endgroup$
    – Bass
    Dec 15 '18 at 16:57










  • $begingroup$
    I think real answer is: Any place!! ;).
    $endgroup$
    – shA.t
    Dec 16 '18 at 12:40














4












4








4





$begingroup$


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.











share|improve this question











$endgroup$




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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 15 '18 at 16:22









JonMark Perry

18k63786




18k63786










asked Dec 15 '18 at 13:58









AgaeusAgaeus

233




233












  • $begingroup$
    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!)
    $endgroup$
    – Deusovi
    Dec 15 '18 at 14:04










  • $begingroup$
    Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
    $endgroup$
    – Agaeus
    Dec 15 '18 at 14:13






  • 1




    $begingroup$
    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.
    $endgroup$
    – Bass
    Dec 15 '18 at 16:57










  • $begingroup$
    I think real answer is: Any place!! ;).
    $endgroup$
    – shA.t
    Dec 16 '18 at 12:40


















  • $begingroup$
    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!)
    $endgroup$
    – Deusovi
    Dec 15 '18 at 14:04










  • $begingroup$
    Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
    $endgroup$
    – Agaeus
    Dec 15 '18 at 14:13






  • 1




    $begingroup$
    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.
    $endgroup$
    – Bass
    Dec 15 '18 at 16:57










  • $begingroup$
    I think real answer is: Any place!! ;).
    $endgroup$
    – shA.t
    Dec 16 '18 at 12:40
















$begingroup$
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!)
$endgroup$
– Deusovi
Dec 15 '18 at 14:04




$begingroup$
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!)
$endgroup$
– Deusovi
Dec 15 '18 at 14:04












$begingroup$
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
$endgroup$
– Agaeus
Dec 15 '18 at 14:13




$begingroup$
Hello there,the puzzle is made by me so i am the source(?),my inspiration started after starting computer science logic.
$endgroup$
– Agaeus
Dec 15 '18 at 14:13




1




1




$begingroup$
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.
$endgroup$
– Bass
Dec 15 '18 at 16:57




$begingroup$
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.
$endgroup$
– Bass
Dec 15 '18 at 16:57












$begingroup$
I think real answer is: Any place!! ;).
$endgroup$
– shA.t
Dec 16 '18 at 12:40




$begingroup$
I think real answer is: Any place!! ;).
$endgroup$
– shA.t
Dec 16 '18 at 12:40










2 Answers
2






active

oldest

votes


















3












$begingroup$

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.







share|improve this answer











$endgroup$













  • $begingroup$
    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.
    $endgroup$
    – deep thought
    Dec 15 '18 at 18:26



















2












$begingroup$

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.







share|improve this answer









$endgroup$













    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    3












    $begingroup$

    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.







    share|improve this answer











    $endgroup$













    • $begingroup$
      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.
      $endgroup$
      – deep thought
      Dec 15 '18 at 18:26
















    3












    $begingroup$

    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.







    share|improve this answer











    $endgroup$













    • $begingroup$
      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.
      $endgroup$
      – deep thought
      Dec 15 '18 at 18:26














    3












    3








    3





    $begingroup$

    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.







    share|improve this answer











    $endgroup$



    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.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 15 '18 at 18:44

























    answered Dec 15 '18 at 16:11









    JonMark PerryJonMark Perry

    18k63786




    18k63786












    • $begingroup$
      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.
      $endgroup$
      – deep thought
      Dec 15 '18 at 18:26


















    • $begingroup$
      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.
      $endgroup$
      – deep thought
      Dec 15 '18 at 18:26
















    $begingroup$
    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.
    $endgroup$
    – deep thought
    Dec 15 '18 at 18:26




    $begingroup$
    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.
    $endgroup$
    – deep thought
    Dec 15 '18 at 18:26











    2












    $begingroup$

    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.







    share|improve this answer









    $endgroup$


















      2












      $begingroup$

      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.







      share|improve this answer









      $endgroup$
















        2












        2








        2





        $begingroup$

        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.







        share|improve this answer









        $endgroup$



        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.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 15 '18 at 16:59









        SteveVSteveV

        5,6052629




        5,6052629






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Список кардиналов, возведённых папой римским Каликстом III

            Deduzione

            Mysql.sock missing - “Can't connect to local MySQL server through socket”