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 A336962 #11 Aug 11 2020 01:25:31 %S A336962 0,1,2,3,6,5,4,7,14,11,10,13,12,9,8,15,30,23,22,27,26,21,20,29,28,19, %T A336962 18,25,24,17,16,31,62,47,46,55,54,45,44,59,58,43,42,53,52,41,40,61,60, %U A336962 39,38,51,50,37,36,57,56,35,34,49,48,33,32,63,126,95,94 %N A336962 Right-rotate run-lengths of consecutive equal digits in binary representation of n. %C A336962 This sequence is a permutation of the nonnegative integers, with inverse A336963. %H A336962 Rémy Sigrist, <a href="/A336962/b336962.txt">Table of n, a(n) for n = 0..8191</a> %H A336962 Rémy Sigrist, <a href="/A336962/a336962.png">Colored scatterplot of the first 2^16 terms</a> (where the color is function of A136480(n)) %H A336962 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A336962 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A336962 a(n) = n iff n = 0 or n belongs to A140690. %e A336962 The first terms, in decimal and in binary, are: %e A336962 n a(n) bin(n) bin(a(n)) %e A336962 -- ---- ------ --------- %e A336962 0 0 0 0 %e A336962 1 1 1 1 %e A336962 2 2 10 10 %e A336962 3 3 11 11 %e A336962 4 6 100 110 %e A336962 5 5 101 101 %e A336962 6 4 110 100 %e A336962 7 7 111 111 %e A336962 8 14 1000 1110 %e A336962 9 11 1001 1011 %e A336962 10 10 1010 1010 %e A336962 11 13 1011 1101 %e A336962 12 12 1100 1100 %e A336962 13 9 1101 1001 %e A336962 14 8 1110 1000 %e A336962 15 15 1111 1111 %o A336962 (PARI) toruns(n) = { my (r=[]); while (n, my (v=valuation(n+n%2,2)); n\=2^v; r=concat(v,r)); r } %o A336962 fromruns(r) = { my (v=0); for (k=1, #r, v=(v+k%2)*2^r[k]-k%2); v } %o A336962 a(n) = { my (r=toruns(n)); fromruns(vector(#r, k, r[1+(k-2)%#r])) } %Y A336962 Cf. A038572, A101211, A136480, A140690, A336963 (inverse). %K A336962 nonn,base %O A336962 0,3 %A A336962 _Rémy Sigrist_, Aug 09 2020