# Binary Numbers Magic Trick

## Perl 6, 63 46 bytes

say grep(*+&2**$_,^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.

## Python 2, 76 bytes

r=range;print[[[i for i in r(61)if i&2**k][j::5]for j in r(5)]for k in r(6)]


Try it online!

The method here is to create a list of all possible numbers r(61) and then whittle that down to the list of numbers for a card i&2**k.

Then, by using list slicing, that 1D list of numbers is rearranged to the correct 6x5 card size [card nums][j::5]for j in r(5).

Then, this generator is just repeated for 6 cards for k in r(6).

While I could not find any solutions less than 76 bytes, here are two others that are also 76 bytes:

r=range;print[[[i for i in r(61)if i&1<<k][j::5]for j in r(5)]for k in r(6)]


Try it online!

This next one is inspired by Jonathan Allan.

k=32
while k:print[[i for i in range(61)if i&k][j::5]for j in range(5)];k/=2


Try it online!

## Charcoal, 26 bytes

Ｅ⁶Ｅ⁵⪫Ｅ⁶§⁺§⪪Φ⁶¹＆πＸ²ι⁵ν⟦*⟧λ


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:

Ｅ⁶                          Loop over 6 cards
Ｅ⁵                        Loop over 5 rows
Ｅ⁶                     Loop over 6 columns
Φ⁶¹              Filter over 0..60 where
π            Current value
＆             Bitwise And
²          Literal 2
Ｘ           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