The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A339132 Milk shuffle of the binary representation of n. 1

%I #35 Jan 04 2021 08:44:21

%S 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,

%T 26,27,30,31,2,3,6,7,18,19,22,23,34,35,38,39,50,51,54,55,10,11,14,15,

%U 26,27,30,31,42,43,46,47,58,59,62,63,2,3,6,7,18,19,22,23

%N Milk shuffle of the binary representation of n.

%H Sander G. Huisman, <a href="/A339132/b339132.txt">Table of n, a(n) for n = 0..5000</a> [a(0)=0 inserted by _Georg Fischer_, Jan 04 2021]

%H Roger Antonsen, <a href="https://archive.bridgesmathart.org/2018/bridges2018-451.html">Card Shuffling Visualizations</a>, Bridges Conference Proceedings, 2018.

%e For n = 19 we take the binary representation without leading zeros: 10011.

%e We now shuffle the binary digits around according to A209279, which can be interpreted as a so-called milk shuffle.

%e For five digits the n-th digits gets moved around as follows: 1,2,3,4,5 => 3,2,4,1,5.

%e 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.

%e We now apply this reshuffling to our binary digits of 19: 00111.

%e This is now reinterpreted into a decimal number: 7.

%t milk[list_]:=Table[list[[{i,-i}]],{i,Length[list]/2}]//milkPost[#,list]&//Reverse//Flatten

%t milkPost[x_,list_]:=x/;EvenQ[Length[list]]

%t milkPost[x_,list_]:=Join[x,{list[[(Length[list]+1)/2]]}]

%t Table[FromDigits[milk@IntegerDigits[i,2],2],{i,0,500}]

%t (*OR*)

%t Table[FromDigits[ResourceFunction["Shuffle"][IntegerDigits[i,2],"Milk"],2], {i,0,500}]

%Y Cf. A330090 (shuffle bits low to high).

%Y Cf. A209279 (1-based shuffle), A332104 (0-based shuffle).

%K base,easy,look,nonn

%O 0,3

%A _Sander G. Huisman_, Nov 24 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 27 19:58 EDT 2024. Contains 372882 sequences. (Running on oeis4.)