Am I a Rude Number?












3












$begingroup$


For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of a problem when we get to the number four. Specifically, it requires us to put up our middle finger, which results in a rather unfortunate gesture, which is not typically accepted in society. This type of number is a rude number. We come to the next rude number at 36, when we raise the thumb on our second hand and the middle finger of our first hand. The definition of a rude number is any number that, under this system of counting, results in us putting up only the middle finger of any hand. Once we pass 1023 (the maximum number reachable on one hand), assume we continue with a third hand, with additional hands added as required.



Your Task:



Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a rude number.



Input:



An integer between 0 and 10^9 (inclusive).



Output:



A truthy/falsy value that indicates whether the input is a rude number.



Test Cases:



Input:    Output:
0 ---> falsy
3 ---> falsy
4 ---> truthy
25 ---> falsy
36 ---> truthy
127 ---> falsy
131 ---> truthy


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$








  • 3




    $begingroup$
    assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
    $endgroup$
    – Veskah
    1 hour ago






  • 1




    $begingroup$
    @Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    You can reach 1023 on one hand? O_o
    $endgroup$
    – ASCII-only
    31 mins ago










  • $begingroup$
    BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
    $endgroup$
    – ASCII-only
    19 mins ago
















3












$begingroup$


For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of a problem when we get to the number four. Specifically, it requires us to put up our middle finger, which results in a rather unfortunate gesture, which is not typically accepted in society. This type of number is a rude number. We come to the next rude number at 36, when we raise the thumb on our second hand and the middle finger of our first hand. The definition of a rude number is any number that, under this system of counting, results in us putting up only the middle finger of any hand. Once we pass 1023 (the maximum number reachable on one hand), assume we continue with a third hand, with additional hands added as required.



Your Task:



Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a rude number.



Input:



An integer between 0 and 10^9 (inclusive).



Output:



A truthy/falsy value that indicates whether the input is a rude number.



Test Cases:



Input:    Output:
0 ---> falsy
3 ---> falsy
4 ---> truthy
25 ---> falsy
36 ---> truthy
127 ---> falsy
131 ---> truthy


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$








  • 3




    $begingroup$
    assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
    $endgroup$
    – Veskah
    1 hour ago






  • 1




    $begingroup$
    @Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    You can reach 1023 on one hand? O_o
    $endgroup$
    – ASCII-only
    31 mins ago










  • $begingroup$
    BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
    $endgroup$
    – ASCII-only
    19 mins ago














3












3








3





$begingroup$


For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of a problem when we get to the number four. Specifically, it requires us to put up our middle finger, which results in a rather unfortunate gesture, which is not typically accepted in society. This type of number is a rude number. We come to the next rude number at 36, when we raise the thumb on our second hand and the middle finger of our first hand. The definition of a rude number is any number that, under this system of counting, results in us putting up only the middle finger of any hand. Once we pass 1023 (the maximum number reachable on one hand), assume we continue with a third hand, with additional hands added as required.



Your Task:



Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a rude number.



Input:



An integer between 0 and 10^9 (inclusive).



Output:



A truthy/falsy value that indicates whether the input is a rude number.



Test Cases:



Input:    Output:
0 ---> falsy
3 ---> falsy
4 ---> truthy
25 ---> falsy
36 ---> truthy
127 ---> falsy
131 ---> truthy


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$




For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of a problem when we get to the number four. Specifically, it requires us to put up our middle finger, which results in a rather unfortunate gesture, which is not typically accepted in society. This type of number is a rude number. We come to the next rude number at 36, when we raise the thumb on our second hand and the middle finger of our first hand. The definition of a rude number is any number that, under this system of counting, results in us putting up only the middle finger of any hand. Once we pass 1023 (the maximum number reachable on one hand), assume we continue with a third hand, with additional hands added as required.



Your Task:



Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a rude number.



Input:



An integer between 0 and 10^9 (inclusive).



Output:



A truthy/falsy value that indicates whether the input is a rude number.



Test Cases:



Input:    Output:
0 ---> falsy
3 ---> falsy
4 ---> truthy
25 ---> falsy
36 ---> truthy
127 ---> falsy
131 ---> truthy


Scoring:



This is code-golf, so the lowest score in bytes wins.







code-golf number decision-problem






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 58 mins ago







Gryphon

















asked 1 hour ago









GryphonGryphon

3,1891963




3,1891963








  • 3




    $begingroup$
    assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
    $endgroup$
    – Veskah
    1 hour ago






  • 1




    $begingroup$
    @Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    You can reach 1023 on one hand? O_o
    $endgroup$
    – ASCII-only
    31 mins ago










  • $begingroup$
    BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
    $endgroup$
    – ASCII-only
    19 mins ago














  • 3




    $begingroup$
    assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
    $endgroup$
    – Veskah
    1 hour ago






  • 1




    $begingroup$
    @Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
    $endgroup$
    – Gryphon
    1 hour ago










  • $begingroup$
    You can reach 1023 on one hand? O_o
    $endgroup$
    – ASCII-only
    31 mins ago










  • $begingroup$
    BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
    $endgroup$
    – ASCII-only
    19 mins ago








3




3




$begingroup$
assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
$endgroup$
– Veskah
1 hour ago




$begingroup$
assume we continue with a third hand, When it comes to being rude, teamwork makes the dream work.
$endgroup$
– Veskah
1 hour ago




1




1




$begingroup$
@Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
$endgroup$
– Gryphon
1 hour ago




$begingroup$
@Veskah turns out that for the bounds of the question, you only need 3 people to make any given number. Sure beats the old kind of counting on fingers.
$endgroup$
– Gryphon
1 hour ago












$begingroup$
Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
$endgroup$
– Gryphon
1 hour ago




$begingroup$
Also, I don't have the time at the moment, but if anyone could figure out an equation for this sequence, that'd be great.
$endgroup$
– Gryphon
1 hour ago












$begingroup$
You can reach 1023 on one hand? O_o
$endgroup$
– ASCII-only
31 mins ago




$begingroup$
You can reach 1023 on one hand? O_o
$endgroup$
– ASCII-only
31 mins ago












$begingroup$
BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
$endgroup$
– ASCII-only
19 mins ago




$begingroup$
BTW, pretty sure there is no short equation for this sequence, but you could (kinda) make a separate equation for each hand
$endgroup$
– ASCII-only
19 mins ago










6 Answers
6






active

oldest

votes


















3












$begingroup$


JavaScript (SpiderMonkey), 27 bytes





x=>/4/.test(x.toString(32))


Try it online!



This is a trivial solution, you just want to convert to base 32 and check if there is a 4 in it.






share|improve this answer









$endgroup$





















    2












    $begingroup$


    Japt, 5 bytes



    sH ø4


    Try it online!



    Explanation



          // Implicit input
    sH // To a base-H (=32) string
    ø // Contains
    4 // 4 (JavaScript interprets this as a string)





    share|improve this answer









    $endgroup$





















      2












      $begingroup$

      Ruby, 36 19 bytes





      ->n{n.to_s(32)[?4]}


      Try it online!



      Saved 17 bytes with @tsh's method.






      share|improve this answer











      $endgroup$













      • $begingroup$
        This returns true for 2207, which has a binary representation of 100010011111
        $endgroup$
        – Embodiment of Ignorance
        43 mins ago










      • $begingroup$
        @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
        $endgroup$
        – Doorknob
        37 mins ago










      • $begingroup$
        I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
        $endgroup$
        – tsh
        33 mins ago












      • $begingroup$
        @tsh because I'm not as clever as you :)
        $endgroup$
        – Doorknob
        30 mins ago










      • $begingroup$
        Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
        $endgroup$
        – Embodiment of Ignorance
        25 mins ago



















      2












      $begingroup$


      Perl 6, 16 bytes





      {.base(32)~~/4/}


      Try it online!



      Checks if there is a 4 in the base 32 representation of the number. Returns either Nil as false or a Match containing a 4.



      You can prove this by the fact that $2^5 = 32$ so each digit is the state of each hand.






      share|improve this answer









      $endgroup$





















        1












        $begingroup$

        Regex (ECMAScript), 37 bytes



        ^((?=(x+)(2{31}x*))3)*(x{32})*x{4}$



        Try it online!



        ^
        (
        (?=(x+)(2{31}x*)) # 2 = floor(tail / 32); 3 = tool to make tail = 2
        3 # tail = 2
        )* # Loop the above as many times as necessary to make
        # the below match
        (x{32})*x{4}$ # Assert that tail % 32 == 4





        share|improve this answer











        $endgroup$





















          1












          $begingroup$

          APL+WIN, 10 bytes



          Prompts for input of integer



          4∊(6⍴32)⊤⎕


          Noting six hands are required to represent 10^9 converts to vector of 6 elements of the base 32 representation and checks if a 4 exists in any element.





          share









          $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.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "200"
            };
            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
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f180481%2fam-i-a-rude-number%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            6 Answers
            6






            active

            oldest

            votes








            6 Answers
            6






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$


            JavaScript (SpiderMonkey), 27 bytes





            x=>/4/.test(x.toString(32))


            Try it online!



            This is a trivial solution, you just want to convert to base 32 and check if there is a 4 in it.






            share|improve this answer









            $endgroup$


















              3












              $begingroup$


              JavaScript (SpiderMonkey), 27 bytes





              x=>/4/.test(x.toString(32))


              Try it online!



              This is a trivial solution, you just want to convert to base 32 and check if there is a 4 in it.






              share|improve this answer









              $endgroup$
















                3












                3








                3





                $begingroup$


                JavaScript (SpiderMonkey), 27 bytes





                x=>/4/.test(x.toString(32))


                Try it online!



                This is a trivial solution, you just want to convert to base 32 and check if there is a 4 in it.






                share|improve this answer









                $endgroup$




                JavaScript (SpiderMonkey), 27 bytes





                x=>/4/.test(x.toString(32))


                Try it online!



                This is a trivial solution, you just want to convert to base 32 and check if there is a 4 in it.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 36 mins ago









                tshtsh

                9,15511650




                9,15511650























                    2












                    $begingroup$


                    Japt, 5 bytes



                    sH ø4


                    Try it online!



                    Explanation



                          // Implicit input
                    sH // To a base-H (=32) string
                    ø // Contains
                    4 // 4 (JavaScript interprets this as a string)





                    share|improve this answer









                    $endgroup$


















                      2












                      $begingroup$


                      Japt, 5 bytes



                      sH ø4


                      Try it online!



                      Explanation



                            // Implicit input
                      sH // To a base-H (=32) string
                      ø // Contains
                      4 // 4 (JavaScript interprets this as a string)





                      share|improve this answer









                      $endgroup$
















                        2












                        2








                        2





                        $begingroup$


                        Japt, 5 bytes



                        sH ø4


                        Try it online!



                        Explanation



                              // Implicit input
                        sH // To a base-H (=32) string
                        ø // Contains
                        4 // 4 (JavaScript interprets this as a string)





                        share|improve this answer









                        $endgroup$




                        Japt, 5 bytes



                        sH ø4


                        Try it online!



                        Explanation



                              // Implicit input
                        sH // To a base-H (=32) string
                        ø // Contains
                        4 // 4 (JavaScript interprets this as a string)






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 32 mins ago









                        ASCII-onlyASCII-only

                        3,4801236




                        3,4801236























                            2












                            $begingroup$

                            Ruby, 36 19 bytes





                            ->n{n.to_s(32)[?4]}


                            Try it online!



                            Saved 17 bytes with @tsh's method.






                            share|improve this answer











                            $endgroup$













                            • $begingroup$
                              This returns true for 2207, which has a binary representation of 100010011111
                              $endgroup$
                              – Embodiment of Ignorance
                              43 mins ago










                            • $begingroup$
                              @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                              $endgroup$
                              – Doorknob
                              37 mins ago










                            • $begingroup$
                              I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                              $endgroup$
                              – tsh
                              33 mins ago












                            • $begingroup$
                              @tsh because I'm not as clever as you :)
                              $endgroup$
                              – Doorknob
                              30 mins ago










                            • $begingroup$
                              Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                              $endgroup$
                              – Embodiment of Ignorance
                              25 mins ago
















                            2












                            $begingroup$

                            Ruby, 36 19 bytes





                            ->n{n.to_s(32)[?4]}


                            Try it online!



                            Saved 17 bytes with @tsh's method.






                            share|improve this answer











                            $endgroup$













                            • $begingroup$
                              This returns true for 2207, which has a binary representation of 100010011111
                              $endgroup$
                              – Embodiment of Ignorance
                              43 mins ago










                            • $begingroup$
                              @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                              $endgroup$
                              – Doorknob
                              37 mins ago










                            • $begingroup$
                              I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                              $endgroup$
                              – tsh
                              33 mins ago












                            • $begingroup$
                              @tsh because I'm not as clever as you :)
                              $endgroup$
                              – Doorknob
                              30 mins ago










                            • $begingroup$
                              Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                              $endgroup$
                              – Embodiment of Ignorance
                              25 mins ago














                            2












                            2








                            2





                            $begingroup$

                            Ruby, 36 19 bytes





                            ->n{n.to_s(32)[?4]}


                            Try it online!



                            Saved 17 bytes with @tsh's method.






                            share|improve this answer











                            $endgroup$



                            Ruby, 36 19 bytes





                            ->n{n.to_s(32)[?4]}


                            Try it online!



                            Saved 17 bytes with @tsh's method.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 30 mins ago

























                            answered 1 hour ago









                            DoorknobDoorknob

                            54.9k17115352




                            54.9k17115352












                            • $begingroup$
                              This returns true for 2207, which has a binary representation of 100010011111
                              $endgroup$
                              – Embodiment of Ignorance
                              43 mins ago










                            • $begingroup$
                              @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                              $endgroup$
                              – Doorknob
                              37 mins ago










                            • $begingroup$
                              I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                              $endgroup$
                              – tsh
                              33 mins ago












                            • $begingroup$
                              @tsh because I'm not as clever as you :)
                              $endgroup$
                              – Doorknob
                              30 mins ago










                            • $begingroup$
                              Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                              $endgroup$
                              – Embodiment of Ignorance
                              25 mins ago


















                            • $begingroup$
                              This returns true for 2207, which has a binary representation of 100010011111
                              $endgroup$
                              – Embodiment of Ignorance
                              43 mins ago










                            • $begingroup$
                              @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                              $endgroup$
                              – Doorknob
                              37 mins ago










                            • $begingroup$
                              I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                              $endgroup$
                              – tsh
                              33 mins ago












                            • $begingroup$
                              @tsh because I'm not as clever as you :)
                              $endgroup$
                              – Doorknob
                              30 mins ago










                            • $begingroup$
                              Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                              $endgroup$
                              – Embodiment of Ignorance
                              25 mins ago
















                            $begingroup$
                            This returns true for 2207, which has a binary representation of 100010011111
                            $endgroup$
                            – Embodiment of Ignorance
                            43 mins ago




                            $begingroup$
                            This returns true for 2207, which has a binary representation of 100010011111
                            $endgroup$
                            – Embodiment of Ignorance
                            43 mins ago












                            $begingroup$
                            @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                            $endgroup$
                            – Doorknob
                            37 mins ago




                            $begingroup$
                            @EmbodimentofIgnorance That is the correct result, is it not? The second hand is 00100.
                            $endgroup$
                            – Doorknob
                            37 mins ago












                            $begingroup$
                            I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                            $endgroup$
                            – tsh
                            33 mins ago






                            $begingroup$
                            I don't speak Ruby. But why not ->n{n.to_s(32)=~/4/}?
                            $endgroup$
                            – tsh
                            33 mins ago














                            $begingroup$
                            @tsh because I'm not as clever as you :)
                            $endgroup$
                            – Doorknob
                            30 mins ago




                            $begingroup$
                            @tsh because I'm not as clever as you :)
                            $endgroup$
                            – Doorknob
                            30 mins ago












                            $begingroup$
                            Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                            $endgroup$
                            – Embodiment of Ignorance
                            25 mins ago




                            $begingroup$
                            Forgive me if I'm not understanding the question, but isn't the first hand of 2207 10001, the second 00111, and the third 11? None of them have their middle finger only up
                            $endgroup$
                            – Embodiment of Ignorance
                            25 mins ago











                            2












                            $begingroup$


                            Perl 6, 16 bytes





                            {.base(32)~~/4/}


                            Try it online!



                            Checks if there is a 4 in the base 32 representation of the number. Returns either Nil as false or a Match containing a 4.



                            You can prove this by the fact that $2^5 = 32$ so each digit is the state of each hand.






                            share|improve this answer









                            $endgroup$


















                              2












                              $begingroup$


                              Perl 6, 16 bytes





                              {.base(32)~~/4/}


                              Try it online!



                              Checks if there is a 4 in the base 32 representation of the number. Returns either Nil as false or a Match containing a 4.



                              You can prove this by the fact that $2^5 = 32$ so each digit is the state of each hand.






                              share|improve this answer









                              $endgroup$
















                                2












                                2








                                2





                                $begingroup$


                                Perl 6, 16 bytes





                                {.base(32)~~/4/}


                                Try it online!



                                Checks if there is a 4 in the base 32 representation of the number. Returns either Nil as false or a Match containing a 4.



                                You can prove this by the fact that $2^5 = 32$ so each digit is the state of each hand.






                                share|improve this answer









                                $endgroup$




                                Perl 6, 16 bytes





                                {.base(32)~~/4/}


                                Try it online!



                                Checks if there is a 4 in the base 32 representation of the number. Returns either Nil as false or a Match containing a 4.



                                You can prove this by the fact that $2^5 = 32$ so each digit is the state of each hand.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered 27 mins ago









                                Jo KingJo King

                                23.7k257123




                                23.7k257123























                                    1












                                    $begingroup$

                                    Regex (ECMAScript), 37 bytes



                                    ^((?=(x+)(2{31}x*))3)*(x{32})*x{4}$



                                    Try it online!



                                    ^
                                    (
                                    (?=(x+)(2{31}x*)) # 2 = floor(tail / 32); 3 = tool to make tail = 2
                                    3 # tail = 2
                                    )* # Loop the above as many times as necessary to make
                                    # the below match
                                    (x{32})*x{4}$ # Assert that tail % 32 == 4





                                    share|improve this answer











                                    $endgroup$


















                                      1












                                      $begingroup$

                                      Regex (ECMAScript), 37 bytes



                                      ^((?=(x+)(2{31}x*))3)*(x{32})*x{4}$



                                      Try it online!



                                      ^
                                      (
                                      (?=(x+)(2{31}x*)) # 2 = floor(tail / 32); 3 = tool to make tail = 2
                                      3 # tail = 2
                                      )* # Loop the above as many times as necessary to make
                                      # the below match
                                      (x{32})*x{4}$ # Assert that tail % 32 == 4





                                      share|improve this answer











                                      $endgroup$
















                                        1












                                        1








                                        1





                                        $begingroup$

                                        Regex (ECMAScript), 37 bytes



                                        ^((?=(x+)(2{31}x*))3)*(x{32})*x{4}$



                                        Try it online!



                                        ^
                                        (
                                        (?=(x+)(2{31}x*)) # 2 = floor(tail / 32); 3 = tool to make tail = 2
                                        3 # tail = 2
                                        )* # Loop the above as many times as necessary to make
                                        # the below match
                                        (x{32})*x{4}$ # Assert that tail % 32 == 4





                                        share|improve this answer











                                        $endgroup$



                                        Regex (ECMAScript), 37 bytes



                                        ^((?=(x+)(2{31}x*))3)*(x{32})*x{4}$



                                        Try it online!



                                        ^
                                        (
                                        (?=(x+)(2{31}x*)) # 2 = floor(tail / 32); 3 = tool to make tail = 2
                                        3 # tail = 2
                                        )* # Loop the above as many times as necessary to make
                                        # the below match
                                        (x{32})*x{4}$ # Assert that tail % 32 == 4






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited 30 mins ago

























                                        answered 37 mins ago









                                        DeadcodeDeadcode

                                        1,7241419




                                        1,7241419























                                            1












                                            $begingroup$

                                            APL+WIN, 10 bytes



                                            Prompts for input of integer



                                            4∊(6⍴32)⊤⎕


                                            Noting six hands are required to represent 10^9 converts to vector of 6 elements of the base 32 representation and checks if a 4 exists in any element.





                                            share









                                            $endgroup$


















                                              1












                                              $begingroup$

                                              APL+WIN, 10 bytes



                                              Prompts for input of integer



                                              4∊(6⍴32)⊤⎕


                                              Noting six hands are required to represent 10^9 converts to vector of 6 elements of the base 32 representation and checks if a 4 exists in any element.





                                              share









                                              $endgroup$
















                                                1












                                                1








                                                1





                                                $begingroup$

                                                APL+WIN, 10 bytes



                                                Prompts for input of integer



                                                4∊(6⍴32)⊤⎕


                                                Noting six hands are required to represent 10^9 converts to vector of 6 elements of the base 32 representation and checks if a 4 exists in any element.





                                                share









                                                $endgroup$



                                                APL+WIN, 10 bytes



                                                Prompts for input of integer



                                                4∊(6⍴32)⊤⎕


                                                Noting six hands are required to represent 10^9 converts to vector of 6 elements of the base 32 representation and checks if a 4 exists in any element.






                                                share











                                                share


                                                share










                                                answered 8 mins ago









                                                GrahamGraham

                                                2,34678




                                                2,34678






























                                                    draft saved

                                                    draft discarded




















































                                                    If this is an answer to a challenge…




                                                    • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                    • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                      Explanations of your answer make it more interesting to read and are very much encouraged.


                                                    • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                    More generally…




                                                    • …Please make sure to answer the question and provide sufficient detail.


                                                    • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f180481%2fam-i-a-rude-number%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

                                                    Bundesstraße 106

                                                    Verónica Boquete

                                                    Ida-Boy-Ed-Garten