This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A329303 #22 Dec 02 2019 21:15:57 %S A329303 0,1,2,3,4,5,6,7,8,11,10,9,12,13,14,15,16,23,20,19,22,21,18,17,24,27, %T A329303 26,25,28,29,30,31,32,47,40,39,44,43,36,35,46,41,42,45,38,37,34,33,48, %U A329303 55,52,51,54,53,50,49,56,59,58,57,60,61,62,63,64,95,80,79 %N A329303 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(3), r(5), ..., r(6), r(4), r(2)). %C A329303 This sequence is a permutation of the nonnegative integers that preserves the binary length as well as the number of runs. See A330091 for the inverse. %H A329303 Rémy Sigrist, <a href="/A329303/b329303.txt">Table of n, a(n) for n = 0..8192</a> %H A329303 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A329303 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A329303 If n has w binary runs, then a^A003558(w-1)(n) = n (where a^k denotes the k-th iterate of the sequence). %e A329303 For n = 19999: %e A329303 - the binary representation of 19999 is "100111000011111", %e A329303 - the corresponding run lengths are (1, 2, 3, 4, 5), %e A329303 - hence the run lengths of a(n) are (1, 3, 5, 4, 2), %e A329303 - and its binary representation is "100011111000011", %e A329303 - so a(n) = 18371. %o A329303 (PARI) torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2),2)); rr = concat(r, rr); n\=2^r); rr } %o A329303 shuffle(v) = { my (w=vector(#v), o=0, e=#v+1); for (k=1, #v, w[if (k%2, o++, e--)]=v[k]); w } %o A329303 fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v } %o A329303 a(n) = fromrl(shuffle(torl(n))) %Y A329303 See A330081 for a similar sequence. %Y A329303 Cf. A003558, A194959, A330091 (inverse). %K A329303 nonn,base %O A329303 0,3 %A A329303 _Rémy Sigrist_, Dec 01 2019