

A339132


Milk shuffle of the binary representation of n.


1



0, 1, 2, 3, 2, 3, 6, 7, 2, 3, 6, 7, 10, 11, 14, 15, 2, 3, 6, 7, 18, 19, 22, 23, 10, 11, 14, 15, 26, 27, 30, 31, 2, 3, 6, 7, 18, 19, 22, 23, 34, 35, 38, 39, 50, 51, 54, 55, 10, 11, 14, 15, 26, 27, 30, 31, 42, 43, 46, 47, 58, 59, 62, 63, 2, 3, 6, 7, 18, 19, 22, 23
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


LINKS

Sander G. Huisman, Table of n, a(n) for n = 0..5000 [a(0)=0 inserted by Georg Fischer, Jan 04 2021]
Roger Antonsen, Card Shuffling Visualizations, Bridges Conference Proceedings, 2018.


EXAMPLE

For n = 19 we take the binary representation without leading zeros: 10011.
We now shuffle the binary digits around according to A209279, which can be interpreted as a socalled milk shuffle.
For five digits the nth digits gets moved around as follows: 1,2,3,4,5 => 3,2,4,1,5.
This reshuffling can be thought of taking the middle number, and then alternatingly taking digits from the left and then the right until all digits are taken.
We now apply this reshuffling to our binary digits of 19: 00111.
This is now reinterpreted into a decimal number: 7.


MATHEMATICA

milk[list_]:=Table[list[[{i, i}]], {i, Length[list]/2}]//milkPost[#, list]&//Reverse//Flatten
milkPost[x_, list_]:=x/; EvenQ[Length[list]]
milkPost[x_, list_]:=Join[x, {list[[(Length[list]+1)/2]]}]
Table[FromDigits[milk@IntegerDigits[i, 2], 2], {i, 0, 500}]
(*OR*)
Table[FromDigits[ResourceFunction["Shuffle"][IntegerDigits[i, 2], "Milk"], 2], {i, 0, 500}]


CROSSREFS

Cf. A330090 (shuffle bits low to high).
Cf. A209279 (1based shuffle), A332104 (0based shuffle).
Sequence in context: A079025 A165930 A300500 * A064895 A120877 A326304
Adjacent sequences: A339129 A339130 A339131 * A339133 A339134 A339135


KEYWORD

base,easy,look,nonn,changed


AUTHOR

Sander G. Huisman, Nov 24 2020


STATUS

approved



