%I #9 Dec 02 2019 21:16:26
%S 0,1,2,3,4,5,6,7,8,11,10,9,12,13,14,15,16,23,22,19,18,21,20,17,24,27,
%T 26,25,28,29,30,31,32,47,46,39,38,45,44,35,34,41,42,37,36,43,40,33,48,
%U 55,54,51,50,53,52,49,56,59,58,57,60,61,62,63,64,95,94,79
%N Inverse permutation to A329303.
%C If the run lengths in binary expansion of n are (r(1), ..., r(w)), then the run lengths in binary expansion of a(n) are (r(1), r(w), r(2), r(w-1), ...); this corresponds to a "milk shuffle".
%H Rémy Sigrist, <a href="/A330091/b330091.txt">Table of n, a(n) for n = 0..8192</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A329303(43) = 45, hence a(45) = 43.
%o (PARI) torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2),2)); rr = concat(r, rr); n\=2^r); rr }
%o unshuffle(v) = { my (w=vector(#v), o=0, e=#v+1); for (k=1, #v, w[k]=v[if (k%2, o++, e--)]); w }
%o fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v }
%o a(n) = fromrl(unshuffle(torl(n)))
%Y Cf. A329303.
%K nonn,base
%O 0,3
%A _Rémy Sigrist_, Dec 01 2019