Binary Numbers Magic Trick












6












$begingroup$


The challenge is simply; output the following six 2D integer arrays:



[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]

[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 19, 30, 39, 50, 59]]

[[ 4, 13, 22, 31, 44, 53],
[ 5, 14, 23, 36, 45, 54],
[ 6, 15, 28, 37, 46, 55],
[ 7, 20, 29, 38, 47, 60],
[12, 21, 30, 39, 52]]

[[ 8, 13, 26, 31, 44, 57],
[ 9, 14, 27, 40, 45, 58],
[10, 15, 28, 41, 46, 59],
[11, 24, 29, 42, 47, 60],
[12, 25, 30, 43, 56]]

[[16, 21, 26, 31, 52, 57],
[17, 22, 27, 48, 53, 58],
[18, 23, 28, 49, 54, 59],
[19, 24, 29, 50, 55, 60],
[20, 25, 30, 51, 56]]

[[32, 37, 42, 47, 52, 57],
[33, 38, 43, 48, 53, 58],
[34, 39, 44, 49, 54, 59],
[35, 40, 45, 50, 55, 60],
[36, 41, 46, 51, 56]]


What are these 2D integer arrays? These are the numbers used in a magic trick with cards containing these numbers:



enter image description here



The magic trick asks someone to think of a number in the range [1, 60], and give the one performing the magic trick all the cards which contain this number. The one performing the magic trick can then sum the top-left numbers (all a power of 2) of the given cards to get to the number the person was thinking of. Some additional explanation of why this works can be found here.



Challenge rules:




  • You can output the six 2D integer arrays in any reasonable format. Can be printed with delimiters; can be a 3D integer array containing the six 2D integer arrays; can be a string-list of lines; etc.

  • You are allowed to fill the bottom right position of the last four cards with a negative value in the range [-60, -1] or character '*' instead of leaving it out to make the 2D integer arrays rectangular matrices (no, you are not allowed to fill them with 0 or a non-integer like null/undefined as alternative, with the exception of * since a star is also used in the actual cards).

  • The order of the numbers in the matrices is mandatory. Although it doesn't matter for the physical magic trick, I see this challenge mainly as a matrix-kolmogorov-complexity one, hence the restriction on order.

    The order of the matrices themselves in the output list can be in any order, since it's clear from the top-left card which matrix is which.


General rules:




  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.










share|improve this question











$endgroup$












  • $begingroup$
    Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
    $endgroup$
    – Kevin Cruijssen
    1 hour ago
















6












$begingroup$


The challenge is simply; output the following six 2D integer arrays:



[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]

[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 19, 30, 39, 50, 59]]

[[ 4, 13, 22, 31, 44, 53],
[ 5, 14, 23, 36, 45, 54],
[ 6, 15, 28, 37, 46, 55],
[ 7, 20, 29, 38, 47, 60],
[12, 21, 30, 39, 52]]

[[ 8, 13, 26, 31, 44, 57],
[ 9, 14, 27, 40, 45, 58],
[10, 15, 28, 41, 46, 59],
[11, 24, 29, 42, 47, 60],
[12, 25, 30, 43, 56]]

[[16, 21, 26, 31, 52, 57],
[17, 22, 27, 48, 53, 58],
[18, 23, 28, 49, 54, 59],
[19, 24, 29, 50, 55, 60],
[20, 25, 30, 51, 56]]

[[32, 37, 42, 47, 52, 57],
[33, 38, 43, 48, 53, 58],
[34, 39, 44, 49, 54, 59],
[35, 40, 45, 50, 55, 60],
[36, 41, 46, 51, 56]]


What are these 2D integer arrays? These are the numbers used in a magic trick with cards containing these numbers:



enter image description here



The magic trick asks someone to think of a number in the range [1, 60], and give the one performing the magic trick all the cards which contain this number. The one performing the magic trick can then sum the top-left numbers (all a power of 2) of the given cards to get to the number the person was thinking of. Some additional explanation of why this works can be found here.



Challenge rules:




  • You can output the six 2D integer arrays in any reasonable format. Can be printed with delimiters; can be a 3D integer array containing the six 2D integer arrays; can be a string-list of lines; etc.

  • You are allowed to fill the bottom right position of the last four cards with a negative value in the range [-60, -1] or character '*' instead of leaving it out to make the 2D integer arrays rectangular matrices (no, you are not allowed to fill them with 0 or a non-integer like null/undefined as alternative, with the exception of * since a star is also used in the actual cards).

  • The order of the numbers in the matrices is mandatory. Although it doesn't matter for the physical magic trick, I see this challenge mainly as a matrix-kolmogorov-complexity one, hence the restriction on order.

    The order of the matrices themselves in the output list can be in any order, since it's clear from the top-left card which matrix is which.


General rules:




  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.










share|improve this question











$endgroup$












  • $begingroup$
    Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
    $endgroup$
    – Kevin Cruijssen
    1 hour ago














6












6








6





$begingroup$


The challenge is simply; output the following six 2D integer arrays:



[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]

[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 19, 30, 39, 50, 59]]

[[ 4, 13, 22, 31, 44, 53],
[ 5, 14, 23, 36, 45, 54],
[ 6, 15, 28, 37, 46, 55],
[ 7, 20, 29, 38, 47, 60],
[12, 21, 30, 39, 52]]

[[ 8, 13, 26, 31, 44, 57],
[ 9, 14, 27, 40, 45, 58],
[10, 15, 28, 41, 46, 59],
[11, 24, 29, 42, 47, 60],
[12, 25, 30, 43, 56]]

[[16, 21, 26, 31, 52, 57],
[17, 22, 27, 48, 53, 58],
[18, 23, 28, 49, 54, 59],
[19, 24, 29, 50, 55, 60],
[20, 25, 30, 51, 56]]

[[32, 37, 42, 47, 52, 57],
[33, 38, 43, 48, 53, 58],
[34, 39, 44, 49, 54, 59],
[35, 40, 45, 50, 55, 60],
[36, 41, 46, 51, 56]]


What are these 2D integer arrays? These are the numbers used in a magic trick with cards containing these numbers:



enter image description here



The magic trick asks someone to think of a number in the range [1, 60], and give the one performing the magic trick all the cards which contain this number. The one performing the magic trick can then sum the top-left numbers (all a power of 2) of the given cards to get to the number the person was thinking of. Some additional explanation of why this works can be found here.



Challenge rules:




  • You can output the six 2D integer arrays in any reasonable format. Can be printed with delimiters; can be a 3D integer array containing the six 2D integer arrays; can be a string-list of lines; etc.

  • You are allowed to fill the bottom right position of the last four cards with a negative value in the range [-60, -1] or character '*' instead of leaving it out to make the 2D integer arrays rectangular matrices (no, you are not allowed to fill them with 0 or a non-integer like null/undefined as alternative, with the exception of * since a star is also used in the actual cards).

  • The order of the numbers in the matrices is mandatory. Although it doesn't matter for the physical magic trick, I see this challenge mainly as a matrix-kolmogorov-complexity one, hence the restriction on order.

    The order of the matrices themselves in the output list can be in any order, since it's clear from the top-left card which matrix is which.


General rules:




  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.










share|improve this question











$endgroup$




The challenge is simply; output the following six 2D integer arrays:



[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]

[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 19, 30, 39, 50, 59]]

[[ 4, 13, 22, 31, 44, 53],
[ 5, 14, 23, 36, 45, 54],
[ 6, 15, 28, 37, 46, 55],
[ 7, 20, 29, 38, 47, 60],
[12, 21, 30, 39, 52]]

[[ 8, 13, 26, 31, 44, 57],
[ 9, 14, 27, 40, 45, 58],
[10, 15, 28, 41, 46, 59],
[11, 24, 29, 42, 47, 60],
[12, 25, 30, 43, 56]]

[[16, 21, 26, 31, 52, 57],
[17, 22, 27, 48, 53, 58],
[18, 23, 28, 49, 54, 59],
[19, 24, 29, 50, 55, 60],
[20, 25, 30, 51, 56]]

[[32, 37, 42, 47, 52, 57],
[33, 38, 43, 48, 53, 58],
[34, 39, 44, 49, 54, 59],
[35, 40, 45, 50, 55, 60],
[36, 41, 46, 51, 56]]


What are these 2D integer arrays? These are the numbers used in a magic trick with cards containing these numbers:



enter image description here



The magic trick asks someone to think of a number in the range [1, 60], and give the one performing the magic trick all the cards which contain this number. The one performing the magic trick can then sum the top-left numbers (all a power of 2) of the given cards to get to the number the person was thinking of. Some additional explanation of why this works can be found here.



Challenge rules:




  • You can output the six 2D integer arrays in any reasonable format. Can be printed with delimiters; can be a 3D integer array containing the six 2D integer arrays; can be a string-list of lines; etc.

  • You are allowed to fill the bottom right position of the last four cards with a negative value in the range [-60, -1] or character '*' instead of leaving it out to make the 2D integer arrays rectangular matrices (no, you are not allowed to fill them with 0 or a non-integer like null/undefined as alternative, with the exception of * since a star is also used in the actual cards).

  • The order of the numbers in the matrices is mandatory. Although it doesn't matter for the physical magic trick, I see this challenge mainly as a matrix-kolmogorov-complexity one, hence the restriction on order.

    The order of the matrices themselves in the output list can be in any order, since it's clear from the top-left card which matrix is which.


General rules:




  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.







code-golf number kolmogorov-complexity matrix






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 1 hour ago







Kevin Cruijssen

















asked 1 hour ago









Kevin CruijssenKevin Cruijssen

43.7k573222




43.7k573222












  • $begingroup$
    Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
    $endgroup$
    – Kevin Cruijssen
    1 hour ago


















  • $begingroup$
    Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
    $endgroup$
    – Kevin Cruijssen
    1 hour ago
















$begingroup$
Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
$endgroup$
– Kevin Cruijssen
1 hour ago




$begingroup$
Related. (As in, it's referring to the same magic trick, but not really useful to get inspiration from for this challenge I think. That challenge asks to output a truthy/falsey value whether number n appears on the k'th card; where my challenge is a KC-challenge to output the six matrices.)
$endgroup$
– Kevin Cruijssen
1 hour ago










4 Answers
4






active

oldest

votes


















3












$begingroup$


Perl 6, 63 bytes





say(grep(+*.base(2).flip.comb[$_],^61)[$_,*+5...*for ^5])for ^6


Try it online!



Outputs as 2D arrays on multiple lines, with the last array of each one cut off if necessary.






share|improve this answer









$endgroup$





















    2












    $begingroup$

    JavaScript (ES6), 90 bytes





    _=>[1,2,4,8,16,32].map(n=>(g=i=>i<60?g(++i,i&n&&(m[y%5]=m[y++%5]||).push(i)):m)(y=m=))


    Try it online!






    share|improve this answer









    $endgroup$





















      1












      $begingroup$


      C (gcc), 105 bytes





      f(int o[6][5][6]){for(int i=0,j,k;i<6;++i){o[i][4][5]=-1;for(j=k=0;j<60;)++j&1<<i?o[i][k%5][k++/5]=j:0;}}


      Try it online!



      Returns the matrices as a 3D int array in o.



      The last 4 matrices have -1 as their last value.






      share|improve this answer









      $endgroup$













      • $begingroup$
        You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
        $endgroup$
        – Kevin Cruijssen
        17 mins ago



















      1












      $begingroup$


      Charcoal, 26 bytes



      E⁶E⁵⪫E⁶§⁺§⪪Φ⁶¹&πX²ι⁵ν⟦*⟧λ 


      Try it online! Link is to verbose version of code. I tried calculating the entries directly but this was already 27 bytes before adjusting for the * in the bottom right. Outputs each row joined with spaces and a blank line between cards. Explanation:



      E⁶                          Loop over 6 cards
      E⁵ Loop over 5 rows
      E⁶ Loop over 6 columns
      Φ⁶¹ Filter over 0..60 where
      π Current value
      & Bitwise And
      ² Literal 2
      X Raised to power
      ι Card index
      ⪪ ⁵ Split into groups of 5
      § ν Indexed by column
      ⁺ Concatenated with
      * Literal string `*`
      ⟦ ⟧ Wrapped in an array
      § λ Indexed by row
      ⪫ Joined with spaces
      Implicitly print




      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%2f184853%2fbinary-numbers-magic-trick%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        3












        $begingroup$


        Perl 6, 63 bytes





        say(grep(+*.base(2).flip.comb[$_],^61)[$_,*+5...*for ^5])for ^6


        Try it online!



        Outputs as 2D arrays on multiple lines, with the last array of each one cut off if necessary.






        share|improve this answer









        $endgroup$


















          3












          $begingroup$


          Perl 6, 63 bytes





          say(grep(+*.base(2).flip.comb[$_],^61)[$_,*+5...*for ^5])for ^6


          Try it online!



          Outputs as 2D arrays on multiple lines, with the last array of each one cut off if necessary.






          share|improve this answer









          $endgroup$
















            3












            3








            3





            $begingroup$


            Perl 6, 63 bytes





            say(grep(+*.base(2).flip.comb[$_],^61)[$_,*+5...*for ^5])for ^6


            Try it online!



            Outputs as 2D arrays on multiple lines, with the last array of each one cut off if necessary.






            share|improve this answer









            $endgroup$




            Perl 6, 63 bytes





            say(grep(+*.base(2).flip.comb[$_],^61)[$_,*+5...*for ^5])for ^6


            Try it online!



            Outputs as 2D arrays on multiple lines, with the last array of each one cut off if necessary.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 1 hour ago









            Jo KingJo King

            27.7k366134




            27.7k366134























                2












                $begingroup$

                JavaScript (ES6), 90 bytes





                _=>[1,2,4,8,16,32].map(n=>(g=i=>i<60?g(++i,i&n&&(m[y%5]=m[y++%5]||).push(i)):m)(y=m=))


                Try it online!






                share|improve this answer









                $endgroup$


















                  2












                  $begingroup$

                  JavaScript (ES6), 90 bytes





                  _=>[1,2,4,8,16,32].map(n=>(g=i=>i<60?g(++i,i&n&&(m[y%5]=m[y++%5]||).push(i)):m)(y=m=))


                  Try it online!






                  share|improve this answer









                  $endgroup$
















                    2












                    2








                    2





                    $begingroup$

                    JavaScript (ES6), 90 bytes





                    _=>[1,2,4,8,16,32].map(n=>(g=i=>i<60?g(++i,i&n&&(m[y%5]=m[y++%5]||).push(i)):m)(y=m=))


                    Try it online!






                    share|improve this answer









                    $endgroup$



                    JavaScript (ES6), 90 bytes





                    _=>[1,2,4,8,16,32].map(n=>(g=i=>i<60?g(++i,i&n&&(m[y%5]=m[y++%5]||).push(i)):m)(y=m=))


                    Try it online!







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered 21 mins ago









                    ArnauldArnauld

                    82.4k798339




                    82.4k798339























                        1












                        $begingroup$


                        C (gcc), 105 bytes





                        f(int o[6][5][6]){for(int i=0,j,k;i<6;++i){o[i][4][5]=-1;for(j=k=0;j<60;)++j&1<<i?o[i][k%5][k++/5]=j:0;}}


                        Try it online!



                        Returns the matrices as a 3D int array in o.



                        The last 4 matrices have -1 as their last value.






                        share|improve this answer









                        $endgroup$













                        • $begingroup$
                          You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                          $endgroup$
                          – Kevin Cruijssen
                          17 mins ago
















                        1












                        $begingroup$


                        C (gcc), 105 bytes





                        f(int o[6][5][6]){for(int i=0,j,k;i<6;++i){o[i][4][5]=-1;for(j=k=0;j<60;)++j&1<<i?o[i][k%5][k++/5]=j:0;}}


                        Try it online!



                        Returns the matrices as a 3D int array in o.



                        The last 4 matrices have -1 as their last value.






                        share|improve this answer









                        $endgroup$













                        • $begingroup$
                          You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                          $endgroup$
                          – Kevin Cruijssen
                          17 mins ago














                        1












                        1








                        1





                        $begingroup$


                        C (gcc), 105 bytes





                        f(int o[6][5][6]){for(int i=0,j,k;i<6;++i){o[i][4][5]=-1;for(j=k=0;j<60;)++j&1<<i?o[i][k%5][k++/5]=j:0;}}


                        Try it online!



                        Returns the matrices as a 3D int array in o.



                        The last 4 matrices have -1 as their last value.






                        share|improve this answer









                        $endgroup$




                        C (gcc), 105 bytes





                        f(int o[6][5][6]){for(int i=0,j,k;i<6;++i){o[i][4][5]=-1;for(j=k=0;j<60;)++j&1<<i?o[i][k%5][k++/5]=j:0;}}


                        Try it online!



                        Returns the matrices as a 3D int array in o.



                        The last 4 matrices have -1 as their last value.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 21 mins ago









                        Matej MulejMatej Mulej

                        712




                        712












                        • $begingroup$
                          You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                          $endgroup$
                          – Kevin Cruijssen
                          17 mins ago


















                        • $begingroup$
                          You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                          $endgroup$
                          – Kevin Cruijssen
                          17 mins ago
















                        $begingroup$
                        You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                        $endgroup$
                        – Kevin Cruijssen
                        17 mins ago




                        $begingroup$
                        You can save 2 bytes by changing o[i][4][5]=-1;for(j=k=0; to for(o[i][4][5]=-1,j=k=0; so the brackets can be removed. Nice answer btw, +1 from me.
                        $endgroup$
                        – Kevin Cruijssen
                        17 mins ago











                        1












                        $begingroup$


                        Charcoal, 26 bytes



                        E⁶E⁵⪫E⁶§⁺§⪪Φ⁶¹&πX²ι⁵ν⟦*⟧λ 


                        Try it online! Link is to verbose version of code. I tried calculating the entries directly but this was already 27 bytes before adjusting for the * in the bottom right. Outputs each row joined with spaces and a blank line between cards. Explanation:



                        E⁶                          Loop over 6 cards
                        E⁵ Loop over 5 rows
                        E⁶ Loop over 6 columns
                        Φ⁶¹ Filter over 0..60 where
                        π Current value
                        & Bitwise And
                        ² Literal 2
                        X Raised to power
                        ι Card index
                        ⪪ ⁵ Split into groups of 5
                        § ν Indexed by column
                        ⁺ Concatenated with
                        * Literal string `*`
                        ⟦ ⟧ Wrapped in an array
                        § λ Indexed by row
                        ⪫ Joined with spaces
                        Implicitly print




                        share









                        $endgroup$


















                          1












                          $begingroup$


                          Charcoal, 26 bytes



                          E⁶E⁵⪫E⁶§⁺§⪪Φ⁶¹&πX²ι⁵ν⟦*⟧λ 


                          Try it online! Link is to verbose version of code. I tried calculating the entries directly but this was already 27 bytes before adjusting for the * in the bottom right. Outputs each row joined with spaces and a blank line between cards. Explanation:



                          E⁶                          Loop over 6 cards
                          E⁵ Loop over 5 rows
                          E⁶ Loop over 6 columns
                          Φ⁶¹ Filter over 0..60 where
                          π Current value
                          & Bitwise And
                          ² Literal 2
                          X Raised to power
                          ι Card index
                          ⪪ ⁵ Split into groups of 5
                          § ν Indexed by column
                          ⁺ Concatenated with
                          * Literal string `*`
                          ⟦ ⟧ Wrapped in an array
                          § λ Indexed by row
                          ⪫ Joined with spaces
                          Implicitly print




                          share









                          $endgroup$
















                            1












                            1








                            1





                            $begingroup$


                            Charcoal, 26 bytes



                            E⁶E⁵⪫E⁶§⁺§⪪Φ⁶¹&πX²ι⁵ν⟦*⟧λ 


                            Try it online! Link is to verbose version of code. I tried calculating the entries directly but this was already 27 bytes before adjusting for the * in the bottom right. Outputs each row joined with spaces and a blank line between cards. Explanation:



                            E⁶                          Loop over 6 cards
                            E⁵ Loop over 5 rows
                            E⁶ Loop over 6 columns
                            Φ⁶¹ Filter over 0..60 where
                            π Current value
                            & Bitwise And
                            ² Literal 2
                            X Raised to power
                            ι Card index
                            ⪪ ⁵ Split into groups of 5
                            § ν Indexed by column
                            ⁺ Concatenated with
                            * Literal string `*`
                            ⟦ ⟧ Wrapped in an array
                            § λ Indexed by row
                            ⪫ Joined with spaces
                            Implicitly print




                            share









                            $endgroup$




                            Charcoal, 26 bytes



                            E⁶E⁵⪫E⁶§⁺§⪪Φ⁶¹&πX²ι⁵ν⟦*⟧λ 


                            Try it online! Link is to verbose version of code. I tried calculating the entries directly but this was already 27 bytes before adjusting for the * in the bottom right. Outputs each row joined with spaces and a blank line between cards. Explanation:



                            E⁶                          Loop over 6 cards
                            E⁵ Loop over 5 rows
                            E⁶ Loop over 6 columns
                            Φ⁶¹ Filter over 0..60 where
                            π Current value
                            & Bitwise And
                            ² Literal 2
                            X Raised to power
                            ι Card index
                            ⪪ ⁵ Split into groups of 5
                            § ν Indexed by column
                            ⁺ Concatenated with
                            * Literal string `*`
                            ⟦ ⟧ Wrapped in an array
                            § λ Indexed by row
                            ⪫ Joined with spaces
                            Implicitly print





                            share











                            share


                            share










                            answered 7 mins ago









                            NeilNeil

                            83.3k745179




                            83.3k745179






























                                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%2f184853%2fbinary-numbers-magic-trick%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

                                GameSpot

                                日野市

                                Tu-95轟炸機