OFFSET
0,3
COMMENTS
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".
LINKS
EXAMPLE
A329303(43) = 45, hence a(45) = 43.
PROG
(PARI) torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2), 2)); rr = concat(r, rr); n\=2^r); rr }
unshuffle(v) = { my (w=vector(#v), o=0, e=#v+1); for (k=1, #v, w[k]=v[if (k%2, o++, e--)]); w }
fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v }
a(n) = fromrl(unshuffle(torl(n)))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Dec 01 2019
STATUS
approved