All ASCII characters with a given bit count Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The PPCG Site design is on its way - help us make it awesome! Sandbox for Proposed ChallengesBiplex: an important useless operatorConvert a “mixed-base” string to ASCIIAll Aboard the ASCII TrainSum of Modulo SumsCount the characters - bit by bit!Calculate the binary split sum of a wordMap inputted ASCII charactersDiluted Integer SumsCount the lucky tickets within the given rangeASCII Art Octagons

How to keep bees out of canned beverages?

Are there existing rules/lore for MTG planeswalkers?

Will I be more secure with my own router behind my ISP's router?

Israeli soda type drink

Protagonist's race is hidden - should I reveal it?

Providing direct feedback to a product salesperson

My admission is revoked after accepting the admission offer

Will I lose my paid in full property

Is there a possibility to generate a list dynamically in Latex?

Translate text contents of an existing file from lower to upper case and copy to a new file

SQL Server placement of master database files vs resource database files

What *exactly* is electrical current, voltage, and resistance?

Putting Ant-Man on house arrest

Can't solve system of linear equations (that need simplification first)

Suing a Police Officer Instead of the Police Department

Why do people think Winterfell crypts is the safest place for women, children & old people?

How to ask rejected full-time candidates to apply to teach individual courses?

Processing ADC conversion result: DMA vs Processor Registers

Raising a bilingual kid. When should we introduce the majority language?

Was Objective-C really a hinderance to Apple software development?

What's parked in Mil Moscow helicopter plant?

Show two Lagrangians are equivalent

How to translate "red flag" into Spanish?

Variable does not exist: sObjectType (Task.sObjectType)



All ASCII characters with a given bit count



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
The PPCG Site design is on its way - help us make it awesome!
Sandbox for Proposed ChallengesBiplex: an important useless operatorConvert a “mixed-base” string to ASCIIAll Aboard the ASCII TrainSum of Modulo SumsCount the characters - bit by bit!Calculate the binary split sum of a wordMap inputted ASCII charactersDiluted Integer SumsCount the lucky tickets within the given rangeASCII Art Octagons










5












$begingroup$


(Title with thanks to @ChasBrown)



Sandbox



The Background



This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.



The Facts



Every printable standard ASCII character has a decimal value between 32 and 126 inclusive. These can be converted to their corresponding binary numbers in the range 100000 to 1111110 inclusive. When you sum the bits of these binary numbers you will always end up with an integer between 1 and 6 inclusive.



The Challenge



Given an integer between 1 and 6 inclusive as input, write a program or function which will output in any acceptable format all of the printable standard ASCII characters where the sum of the bits of their binary value is equal to the input integer.



Examples (showing output in four possible acceptable formats)



Input: 1



Output:

" "

"@"



Input: 2



Output: '!"$(0ABDHP`'



Input: 3



Output: "#%&)*,1248CEFIJLQRTXabdhp"



Input: 6



Output: ['?', '_', 'o', 'w', '', '', '~']



The Rules



  1. Assume the input will always be an integer (or string representation of an integer) between 1 and 6 inclusive.

  2. You may write a program to display the results or a function to return them.

  3. Output may be in any acceptable format but must be consistent for all inputs. If you choose to output a quoted string then the same type of quotes must be used for all inputs.

  4. Standard loopholes prohibited as usual.

  5. This is code golf so shortest code in each language wins.

Test Cases



A full set of expected results is available here (TIO) (ungolfed Python implementation).










share|improve this question









$endgroup$











  • $begingroup$
    Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
    $endgroup$
    – Benjamin Urquhart
    31 mins ago






  • 1




    $begingroup$
    Must be the actual characters.
    $endgroup$
    – ElPedro
    29 mins ago










  • $begingroup$
    Does the order of characters matter?
    $endgroup$
    – gwaugh
    51 secs ago















5












$begingroup$


(Title with thanks to @ChasBrown)



Sandbox



The Background



This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.



The Facts



Every printable standard ASCII character has a decimal value between 32 and 126 inclusive. These can be converted to their corresponding binary numbers in the range 100000 to 1111110 inclusive. When you sum the bits of these binary numbers you will always end up with an integer between 1 and 6 inclusive.



The Challenge



Given an integer between 1 and 6 inclusive as input, write a program or function which will output in any acceptable format all of the printable standard ASCII characters where the sum of the bits of their binary value is equal to the input integer.



Examples (showing output in four possible acceptable formats)



Input: 1



Output:

" "

"@"



Input: 2



Output: '!"$(0ABDHP`'



Input: 3



Output: "#%&)*,1248CEFIJLQRTXabdhp"



Input: 6



Output: ['?', '_', 'o', 'w', '', '', '~']



The Rules



  1. Assume the input will always be an integer (or string representation of an integer) between 1 and 6 inclusive.

  2. You may write a program to display the results or a function to return them.

  3. Output may be in any acceptable format but must be consistent for all inputs. If you choose to output a quoted string then the same type of quotes must be used for all inputs.

  4. Standard loopholes prohibited as usual.

  5. This is code golf so shortest code in each language wins.

Test Cases



A full set of expected results is available here (TIO) (ungolfed Python implementation).










share|improve this question









$endgroup$











  • $begingroup$
    Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
    $endgroup$
    – Benjamin Urquhart
    31 mins ago






  • 1




    $begingroup$
    Must be the actual characters.
    $endgroup$
    – ElPedro
    29 mins ago










  • $begingroup$
    Does the order of characters matter?
    $endgroup$
    – gwaugh
    51 secs ago













5












5








5





$begingroup$


(Title with thanks to @ChasBrown)



Sandbox



The Background



This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.



The Facts



Every printable standard ASCII character has a decimal value between 32 and 126 inclusive. These can be converted to their corresponding binary numbers in the range 100000 to 1111110 inclusive. When you sum the bits of these binary numbers you will always end up with an integer between 1 and 6 inclusive.



The Challenge



Given an integer between 1 and 6 inclusive as input, write a program or function which will output in any acceptable format all of the printable standard ASCII characters where the sum of the bits of their binary value is equal to the input integer.



Examples (showing output in four possible acceptable formats)



Input: 1



Output:

" "

"@"



Input: 2



Output: '!"$(0ABDHP`'



Input: 3



Output: "#%&)*,1248CEFIJLQRTXabdhp"



Input: 6



Output: ['?', '_', 'o', 'w', '', '', '~']



The Rules



  1. Assume the input will always be an integer (or string representation of an integer) between 1 and 6 inclusive.

  2. You may write a program to display the results or a function to return them.

  3. Output may be in any acceptable format but must be consistent for all inputs. If you choose to output a quoted string then the same type of quotes must be used for all inputs.

  4. Standard loopholes prohibited as usual.

  5. This is code golf so shortest code in each language wins.

Test Cases



A full set of expected results is available here (TIO) (ungolfed Python implementation).










share|improve this question









$endgroup$




(Title with thanks to @ChasBrown)



Sandbox



The Background



This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.



The Facts



Every printable standard ASCII character has a decimal value between 32 and 126 inclusive. These can be converted to their corresponding binary numbers in the range 100000 to 1111110 inclusive. When you sum the bits of these binary numbers you will always end up with an integer between 1 and 6 inclusive.



The Challenge



Given an integer between 1 and 6 inclusive as input, write a program or function which will output in any acceptable format all of the printable standard ASCII characters where the sum of the bits of their binary value is equal to the input integer.



Examples (showing output in four possible acceptable formats)



Input: 1



Output:

" "

"@"



Input: 2



Output: '!"$(0ABDHP`'



Input: 3



Output: "#%&)*,1248CEFIJLQRTXabdhp"



Input: 6



Output: ['?', '_', 'o', 'w', '', '', '~']



The Rules



  1. Assume the input will always be an integer (or string representation of an integer) between 1 and 6 inclusive.

  2. You may write a program to display the results or a function to return them.

  3. Output may be in any acceptable format but must be consistent for all inputs. If you choose to output a quoted string then the same type of quotes must be used for all inputs.

  4. Standard loopholes prohibited as usual.

  5. This is code golf so shortest code in each language wins.

Test Cases



A full set of expected results is available here (TIO) (ungolfed Python implementation).







code-golf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 54 mins ago









ElPedroElPedro

3,5881023




3,5881023











  • $begingroup$
    Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
    $endgroup$
    – Benjamin Urquhart
    31 mins ago






  • 1




    $begingroup$
    Must be the actual characters.
    $endgroup$
    – ElPedro
    29 mins ago










  • $begingroup$
    Does the order of characters matter?
    $endgroup$
    – gwaugh
    51 secs ago
















  • $begingroup$
    Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
    $endgroup$
    – Benjamin Urquhart
    31 mins ago






  • 1




    $begingroup$
    Must be the actual characters.
    $endgroup$
    – ElPedro
    29 mins ago










  • $begingroup$
    Does the order of characters matter?
    $endgroup$
    – gwaugh
    51 secs ago















$begingroup$
Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
$endgroup$
– Benjamin Urquhart
31 mins ago




$begingroup$
Are we allowed to return/print a list of the decimal ascii values or do we need to have them in the form of characters (eg. 63 vs ?)?
$endgroup$
– Benjamin Urquhart
31 mins ago




1




1




$begingroup$
Must be the actual characters.
$endgroup$
– ElPedro
29 mins ago




$begingroup$
Must be the actual characters.
$endgroup$
– ElPedro
29 mins ago












$begingroup$
Does the order of characters matter?
$endgroup$
– gwaugh
51 secs ago




$begingroup$
Does the order of characters matter?
$endgroup$
– gwaugh
51 secs ago










10 Answers
10






active

oldest

votes


















2












$begingroup$


Python 2, 69 bytes





lambda n:[chr(i)for i in range(32,127)if sum(map(int,bin(i)[2:]))==n]


Try it online!






share|improve this answer









$endgroup$












  • $begingroup$
    That's exactly what I got when I golfed my ref implementation. +1
    $endgroup$
    – ElPedro
    36 mins ago


















2












$begingroup$

Java 8, 131 bytes



Returns a java.util.stream.Stream<String>



n->java.util.stream.IntStream.range(32,127).filter(i->Long.toBinaryString(i).chars().map(c->c-48).sum()==n).mapToObj(c->(char)c+"")


Try it online!


Using HashSet, 135 bytes. Returns a Set<Object>:



n->new java.util.HashSet()for(int i=31;i++<126;add(Long.toBinaryString(i).chars().map(c->c-48).sum()==n?(char)i+"":""),remove(""));


Try it online!






share|improve this answer











$endgroup$




















    1












    $begingroup$


    Wolfram Language (Mathematica), 70 bytes



    FromCharacterCode/@Select[32~Range~126,s=#;Tr@IntegerDigits[#,2]==s&]&


    Try it online!






    share|improve this answer









    $endgroup$




















      1












      $begingroup$


      05AB1E, 8 bytes



      žQʒÇbSOQ


      Try it online!



      Explanation



      žQ # push the printable ascii characters
      ʒ # filter, keep elements whose
      Ç # character code
      b # converted to binary
      SO # has a digit sum
      Q # equal to the input





      share|improve this answer









      $endgroup$




















        1












        $begingroup$


        Gaia, 10 bytes



        ₵R⟪¤cbΣ=⟫⁇


        Try it online!



        		| implicit input, n
        ₵R | push printable ascii
        ⟪ ⟫⁇ | filter the list where:
        ¤cbΣ | the sum of the code point in binary
        = | is equal to n





        share|improve this answer









        $endgroup$




















          1












          $begingroup$


          Python 2, 62 bytes





          lambda n:[chr(i)for i in range(32,127)if bin(i).count('1')==n]


          Try it online!






          share|improve this answer









          $endgroup$




















            1












            $begingroup$

            dzaima/APL, 26 25 bytes



            ⎕ucs a⌿⍨(+/¨2⊤¨a←32…126)=


            Try it online!





            share









            $endgroup$




















              1












              $begingroup$


              Japt, 9 bytes



              ;EƶXc¤è1


              Try it



              ;EƶXc¤è1 :Implicit input of integer U
              ;E :Printable ASCII
              Æ :Filter each X
              ¶ :Test U for equality with
              Xc : Character code of X
              ¤ : To binary string
              è1 : Count the 1s




              share









              $endgroup$




















                1












                $begingroup$


                JavaScript (Node.js), 70 bytes





                n=>(g=x=>x>>7?'':Buffer((h=x=>x&&x%2+h(x>>1))(x)-n?[]:[x])+g(x+1))(32)


                Try it online!





                share









                $endgroup$




















                  1












                  $begingroup$


                  Jelly, 8 bytes



                  ØṖOB§=ʋƇ


                  Try it online!





                  share









                  $endgroup$













                    Your Answer






                    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%2f183625%2fall-ascii-characters-with-a-given-bit-count%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown

























                    10 Answers
                    10






                    active

                    oldest

                    votes








                    10 Answers
                    10






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    2












                    $begingroup$


                    Python 2, 69 bytes





                    lambda n:[chr(i)for i in range(32,127)if sum(map(int,bin(i)[2:]))==n]


                    Try it online!






                    share|improve this answer









                    $endgroup$












                    • $begingroup$
                      That's exactly what I got when I golfed my ref implementation. +1
                      $endgroup$
                      – ElPedro
                      36 mins ago















                    2












                    $begingroup$


                    Python 2, 69 bytes





                    lambda n:[chr(i)for i in range(32,127)if sum(map(int,bin(i)[2:]))==n]


                    Try it online!






                    share|improve this answer









                    $endgroup$












                    • $begingroup$
                      That's exactly what I got when I golfed my ref implementation. +1
                      $endgroup$
                      – ElPedro
                      36 mins ago













                    2












                    2








                    2





                    $begingroup$


                    Python 2, 69 bytes





                    lambda n:[chr(i)for i in range(32,127)if sum(map(int,bin(i)[2:]))==n]


                    Try it online!






                    share|improve this answer









                    $endgroup$




                    Python 2, 69 bytes





                    lambda n:[chr(i)for i in range(32,127)if sum(map(int,bin(i)[2:]))==n]


                    Try it online!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 37 mins ago









                    NeilNeil

                    2,002324




                    2,002324











                    • $begingroup$
                      That's exactly what I got when I golfed my ref implementation. +1
                      $endgroup$
                      – ElPedro
                      36 mins ago
















                    • $begingroup$
                      That's exactly what I got when I golfed my ref implementation. +1
                      $endgroup$
                      – ElPedro
                      36 mins ago















                    $begingroup$
                    That's exactly what I got when I golfed my ref implementation. +1
                    $endgroup$
                    – ElPedro
                    36 mins ago




                    $begingroup$
                    That's exactly what I got when I golfed my ref implementation. +1
                    $endgroup$
                    – ElPedro
                    36 mins ago











                    2












                    $begingroup$

                    Java 8, 131 bytes



                    Returns a java.util.stream.Stream<String>



                    n->java.util.stream.IntStream.range(32,127).filter(i->Long.toBinaryString(i).chars().map(c->c-48).sum()==n).mapToObj(c->(char)c+"")


                    Try it online!


                    Using HashSet, 135 bytes. Returns a Set<Object>:



                    n->new java.util.HashSet()for(int i=31;i++<126;add(Long.toBinaryString(i).chars().map(c->c-48).sum()==n?(char)i+"":""),remove(""));


                    Try it online!






                    share|improve this answer











                    $endgroup$

















                      2












                      $begingroup$

                      Java 8, 131 bytes



                      Returns a java.util.stream.Stream<String>



                      n->java.util.stream.IntStream.range(32,127).filter(i->Long.toBinaryString(i).chars().map(c->c-48).sum()==n).mapToObj(c->(char)c+"")


                      Try it online!


                      Using HashSet, 135 bytes. Returns a Set<Object>:



                      n->new java.util.HashSet()for(int i=31;i++<126;add(Long.toBinaryString(i).chars().map(c->c-48).sum()==n?(char)i+"":""),remove(""));


                      Try it online!






                      share|improve this answer











                      $endgroup$















                        2












                        2








                        2





                        $begingroup$

                        Java 8, 131 bytes



                        Returns a java.util.stream.Stream<String>



                        n->java.util.stream.IntStream.range(32,127).filter(i->Long.toBinaryString(i).chars().map(c->c-48).sum()==n).mapToObj(c->(char)c+"")


                        Try it online!


                        Using HashSet, 135 bytes. Returns a Set<Object>:



                        n->new java.util.HashSet()for(int i=31;i++<126;add(Long.toBinaryString(i).chars().map(c->c-48).sum()==n?(char)i+"":""),remove(""));


                        Try it online!






                        share|improve this answer











                        $endgroup$



                        Java 8, 131 bytes



                        Returns a java.util.stream.Stream<String>



                        n->java.util.stream.IntStream.range(32,127).filter(i->Long.toBinaryString(i).chars().map(c->c-48).sum()==n).mapToObj(c->(char)c+"")


                        Try it online!


                        Using HashSet, 135 bytes. Returns a Set<Object>:



                        n->new java.util.HashSet()for(int i=31;i++<126;add(Long.toBinaryString(i).chars().map(c->c-48).sum()==n?(char)i+"":""),remove(""));


                        Try it online!







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 6 mins ago

























                        answered 28 mins ago









                        Benjamin UrquhartBenjamin Urquhart

                        688111




                        688111





















                            1












                            $begingroup$


                            Wolfram Language (Mathematica), 70 bytes



                            FromCharacterCode/@Select[32~Range~126,s=#;Tr@IntegerDigits[#,2]==s&]&


                            Try it online!






                            share|improve this answer









                            $endgroup$

















                              1












                              $begingroup$


                              Wolfram Language (Mathematica), 70 bytes



                              FromCharacterCode/@Select[32~Range~126,s=#;Tr@IntegerDigits[#,2]==s&]&


                              Try it online!






                              share|improve this answer









                              $endgroup$















                                1












                                1








                                1





                                $begingroup$


                                Wolfram Language (Mathematica), 70 bytes



                                FromCharacterCode/@Select[32~Range~126,s=#;Tr@IntegerDigits[#,2]==s&]&


                                Try it online!






                                share|improve this answer









                                $endgroup$




                                Wolfram Language (Mathematica), 70 bytes



                                FromCharacterCode/@Select[32~Range~126,s=#;Tr@IntegerDigits[#,2]==s&]&


                                Try it online!







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered 43 mins ago









                                J42161217J42161217

                                14.3k21354




                                14.3k21354





















                                    1












                                    $begingroup$


                                    05AB1E, 8 bytes



                                    žQʒÇbSOQ


                                    Try it online!



                                    Explanation



                                    žQ # push the printable ascii characters
                                    ʒ # filter, keep elements whose
                                    Ç # character code
                                    b # converted to binary
                                    SO # has a digit sum
                                    Q # equal to the input





                                    share|improve this answer









                                    $endgroup$

















                                      1












                                      $begingroup$


                                      05AB1E, 8 bytes



                                      žQʒÇbSOQ


                                      Try it online!



                                      Explanation



                                      žQ # push the printable ascii characters
                                      ʒ # filter, keep elements whose
                                      Ç # character code
                                      b # converted to binary
                                      SO # has a digit sum
                                      Q # equal to the input





                                      share|improve this answer









                                      $endgroup$















                                        1












                                        1








                                        1





                                        $begingroup$


                                        05AB1E, 8 bytes



                                        žQʒÇbSOQ


                                        Try it online!



                                        Explanation



                                        žQ # push the printable ascii characters
                                        ʒ # filter, keep elements whose
                                        Ç # character code
                                        b # converted to binary
                                        SO # has a digit sum
                                        Q # equal to the input





                                        share|improve this answer









                                        $endgroup$




                                        05AB1E, 8 bytes



                                        žQʒÇbSOQ


                                        Try it online!



                                        Explanation



                                        žQ # push the printable ascii characters
                                        ʒ # filter, keep elements whose
                                        Ç # character code
                                        b # converted to binary
                                        SO # has a digit sum
                                        Q # equal to the input






                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 22 mins ago









                                        EmignaEmigna

                                        48.2k434147




                                        48.2k434147





















                                            1












                                            $begingroup$


                                            Gaia, 10 bytes



                                            ₵R⟪¤cbΣ=⟫⁇


                                            Try it online!



                                            		| implicit input, n
                                            ₵R | push printable ascii
                                            ⟪ ⟫⁇ | filter the list where:
                                            ¤cbΣ | the sum of the code point in binary
                                            = | is equal to n





                                            share|improve this answer









                                            $endgroup$

















                                              1












                                              $begingroup$


                                              Gaia, 10 bytes



                                              ₵R⟪¤cbΣ=⟫⁇


                                              Try it online!



                                              		| implicit input, n
                                              ₵R | push printable ascii
                                              ⟪ ⟫⁇ | filter the list where:
                                              ¤cbΣ | the sum of the code point in binary
                                              = | is equal to n





                                              share|improve this answer









                                              $endgroup$















                                                1












                                                1








                                                1





                                                $begingroup$


                                                Gaia, 10 bytes



                                                ₵R⟪¤cbΣ=⟫⁇


                                                Try it online!



                                                		| implicit input, n
                                                ₵R | push printable ascii
                                                ⟪ ⟫⁇ | filter the list where:
                                                ¤cbΣ | the sum of the code point in binary
                                                = | is equal to n





                                                share|improve this answer









                                                $endgroup$




                                                Gaia, 10 bytes



                                                ₵R⟪¤cbΣ=⟫⁇


                                                Try it online!



                                                		| implicit input, n
                                                ₵R | push printable ascii
                                                ⟪ ⟫⁇ | filter the list where:
                                                ¤cbΣ | the sum of the code point in binary
                                                = | is equal to n






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered 19 mins ago









                                                GiuseppeGiuseppe

                                                18k31155




                                                18k31155





















                                                    1












                                                    $begingroup$


                                                    Python 2, 62 bytes





                                                    lambda n:[chr(i)for i in range(32,127)if bin(i).count('1')==n]


                                                    Try it online!






                                                    share|improve this answer









                                                    $endgroup$

















                                                      1












                                                      $begingroup$


                                                      Python 2, 62 bytes





                                                      lambda n:[chr(i)for i in range(32,127)if bin(i).count('1')==n]


                                                      Try it online!






                                                      share|improve this answer









                                                      $endgroup$















                                                        1












                                                        1








                                                        1





                                                        $begingroup$


                                                        Python 2, 62 bytes





                                                        lambda n:[chr(i)for i in range(32,127)if bin(i).count('1')==n]


                                                        Try it online!






                                                        share|improve this answer









                                                        $endgroup$




                                                        Python 2, 62 bytes





                                                        lambda n:[chr(i)for i in range(32,127)if bin(i).count('1')==n]


                                                        Try it online!







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered 12 mins ago









                                                        LynnLynn

                                                        51.2k899234




                                                        51.2k899234





















                                                            1












                                                            $begingroup$

                                                            dzaima/APL, 26 25 bytes



                                                            ⎕ucs a⌿⍨(+/¨2⊤¨a←32…126)=


                                                            Try it online!





                                                            share









                                                            $endgroup$

















                                                              1












                                                              $begingroup$

                                                              dzaima/APL, 26 25 bytes



                                                              ⎕ucs a⌿⍨(+/¨2⊤¨a←32…126)=


                                                              Try it online!





                                                              share









                                                              $endgroup$















                                                                1












                                                                1








                                                                1





                                                                $begingroup$

                                                                dzaima/APL, 26 25 bytes



                                                                ⎕ucs a⌿⍨(+/¨2⊤¨a←32…126)=


                                                                Try it online!





                                                                share









                                                                $endgroup$



                                                                dzaima/APL, 26 25 bytes



                                                                ⎕ucs a⌿⍨(+/¨2⊤¨a←32…126)=


                                                                Try it online!






                                                                share











                                                                share


                                                                share










                                                                answered 9 mins ago









                                                                dzaimadzaima

                                                                16.1k22060




                                                                16.1k22060





















                                                                    1












                                                                    $begingroup$


                                                                    Japt, 9 bytes



                                                                    ;EƶXc¤è1


                                                                    Try it



                                                                    ;EƶXc¤è1 :Implicit input of integer U
                                                                    ;E :Printable ASCII
                                                                    Æ :Filter each X
                                                                    ¶ :Test U for equality with
                                                                    Xc : Character code of X
                                                                    ¤ : To binary string
                                                                    è1 : Count the 1s




                                                                    share









                                                                    $endgroup$

















                                                                      1












                                                                      $begingroup$


                                                                      Japt, 9 bytes



                                                                      ;EƶXc¤è1


                                                                      Try it



                                                                      ;EƶXc¤è1 :Implicit input of integer U
                                                                      ;E :Printable ASCII
                                                                      Æ :Filter each X
                                                                      ¶ :Test U for equality with
                                                                      Xc : Character code of X
                                                                      ¤ : To binary string
                                                                      è1 : Count the 1s




                                                                      share









                                                                      $endgroup$















                                                                        1












                                                                        1








                                                                        1





                                                                        $begingroup$


                                                                        Japt, 9 bytes



                                                                        ;EƶXc¤è1


                                                                        Try it



                                                                        ;EƶXc¤è1 :Implicit input of integer U
                                                                        ;E :Printable ASCII
                                                                        Æ :Filter each X
                                                                        ¶ :Test U for equality with
                                                                        Xc : Character code of X
                                                                        ¤ : To binary string
                                                                        è1 : Count the 1s




                                                                        share









                                                                        $endgroup$




                                                                        Japt, 9 bytes



                                                                        ;EƶXc¤è1


                                                                        Try it



                                                                        ;EƶXc¤è1 :Implicit input of integer U
                                                                        ;E :Printable ASCII
                                                                        Æ :Filter each X
                                                                        ¶ :Test U for equality with
                                                                        Xc : Character code of X
                                                                        ¤ : To binary string
                                                                        è1 : Count the 1s





                                                                        share











                                                                        share


                                                                        share










                                                                        answered 9 mins ago









                                                                        ShaggyShaggy

                                                                        19.1k21768




                                                                        19.1k21768





















                                                                            1












                                                                            $begingroup$


                                                                            JavaScript (Node.js), 70 bytes





                                                                            n=>(g=x=>x>>7?'':Buffer((h=x=>x&&x%2+h(x>>1))(x)-n?[]:[x])+g(x+1))(32)


                                                                            Try it online!





                                                                            share









                                                                            $endgroup$

















                                                                              1












                                                                              $begingroup$


                                                                              JavaScript (Node.js), 70 bytes





                                                                              n=>(g=x=>x>>7?'':Buffer((h=x=>x&&x%2+h(x>>1))(x)-n?[]:[x])+g(x+1))(32)


                                                                              Try it online!





                                                                              share









                                                                              $endgroup$















                                                                                1












                                                                                1








                                                                                1





                                                                                $begingroup$


                                                                                JavaScript (Node.js), 70 bytes





                                                                                n=>(g=x=>x>>7?'':Buffer((h=x=>x&&x%2+h(x>>1))(x)-n?[]:[x])+g(x+1))(32)


                                                                                Try it online!





                                                                                share









                                                                                $endgroup$




                                                                                JavaScript (Node.js), 70 bytes





                                                                                n=>(g=x=>x>>7?'':Buffer((h=x=>x&&x%2+h(x>>1))(x)-n?[]:[x])+g(x+1))(32)


                                                                                Try it online!






                                                                                share











                                                                                share


                                                                                share










                                                                                answered 7 mins ago









                                                                                ArnauldArnauld

                                                                                81.9k798337




                                                                                81.9k798337





















                                                                                    1












                                                                                    $begingroup$


                                                                                    Jelly, 8 bytes



                                                                                    ØṖOB§=ʋƇ


                                                                                    Try it online!





                                                                                    share









                                                                                    $endgroup$

















                                                                                      1












                                                                                      $begingroup$


                                                                                      Jelly, 8 bytes



                                                                                      ØṖOB§=ʋƇ


                                                                                      Try it online!





                                                                                      share









                                                                                      $endgroup$















                                                                                        1












                                                                                        1








                                                                                        1





                                                                                        $begingroup$


                                                                                        Jelly, 8 bytes



                                                                                        ØṖOB§=ʋƇ


                                                                                        Try it online!





                                                                                        share









                                                                                        $endgroup$




                                                                                        Jelly, 8 bytes



                                                                                        ØṖOB§=ʋƇ


                                                                                        Try it online!






                                                                                        share











                                                                                        share


                                                                                        share










                                                                                        answered 2 mins ago









                                                                                        ZylviijZylviij

                                                                                        31014




                                                                                        31014



























                                                                                            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%2f183625%2fall-ascii-characters-with-a-given-bit-count%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

                                                                                            Era Viking Índice Início da Era Viquingue | Cotidiano | Sociedade | Língua | Religião | A arte | As primeiras cidades | As viagens dos viquingues | Viquingues do Oeste e Leste | Fim da Era Viquingue | Fontes históricas | Referências Bibliografia | Ligações externas | Menu de navegação«Sverige då!»«Handel I vikingetid»«O que é Nórdico Antigo»Mito, magia e religião na volsunga saga Um olhar sobre a trajetória mítica do herói sigurd«Bonden var den verklige vikingen»«Vikingatiden»«Vikingatiden»«Vinland»«Guerreiras de Óðinn: As Valkyrjor na Mitologia Viking»1519-9053«Esculpindo símbolos e seres: A arte viking em pedras rúnicas»1679-9313Historia - Tema: VikingarnaAventura e Magia no Mundo das Sagas IslandesasEra Vikinge

                                                                                            What's the metal clinking sound at the end of credits in Avengers: Endgame?What makes Thanos so strong in Avengers: Endgame?Who is the character that appears at the end of Endgame?What happens to Mjolnir (Thor's hammer) at the end of Endgame?The People's Ages in Avengers: EndgameWhat did Nebula do in Avengers: Endgame?Messing with time in the Avengers: Endgame climaxAvengers: Endgame timelineWhat are the time-travel rules in Avengers Endgame?Why use this song in Avengers: Endgame Opening Logo Sequence?Peggy's age in Avengers Endgame

                                                                                            Which organization defines CJK Unified Ideographs? The Next CEO of Stack OverflowCharacters which have several different shapesHow useful are the kanji in reading Chinese?Can Chinese readers scan large amounts of text faster/more accurately than their alphabet-using counterparts?丼: why is “well” also “bowl of food”?What Does Unicode 8.0 Mean For Chinese?How are blanks indicated for placeholders in Chinese (like ???)Is there a dictionary of standard character variants?How to display CJK Extension F?How is it decided as to which character is used on the tech terminology?How does 子 come to mean 'midnight'?