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 A341910 #22 Feb 24 2021 16:17:57 %S A341910 0,1,3,2,5,7,6,4,9,11,15,13,10,14,12,8,17,19,23,21,27,31,29,22,18,25, %T A341910 30,26,20,28,24,16,33,35,39,37,43,47,45,38,46,55,63,59,51,61,53,41,34, %U A341910 42,54,44,57,62,58,49,36,50,60,52,40,56,48,32,65,67,71,69 %N A341910 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of runs in the binary expansion of n equals the number of ones in the binary expansion of a(n). %C A341910 This sequence is a permutation of the nonnegative integers with inverse A341911. %C A341910 Apparently, A037481 corresponds to the fixed points of this sequence. %H A341910 Rémy Sigrist, <a href="/A341910/b341910.txt">Table of n, a(n) for n = 0..8191</a> %H A341910 Rémy Sigrist, <a href="/A341910/a341910.png">Colored scatterplot of the first 2^16 terms</a> (where the color is function of A005811(n)) %H A341910 Rémy Sigrist, <a href="/A341910/a341910.gp.txt">PARI program for A341910</a> %H A341910 Rémy Sigrist, <a href="/A341910/a341910_1.gp.txt">PARI program for A341910 (faster)</a> %H A341910 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A341910 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A341910 A005811(n) = A000120(a(n)). %F A341910 a(n) < 2^k for any n < 2^k. %e A341910 The first terms, in decimal and in binary, are: %e A341910 n a(n) bin(n) bin(a(n)) %e A341910 -- ---- ------- --------- %e A341910 0 0 0 0 %e A341910 1 1 1 1 %e A341910 2 3 10 11 %e A341910 3 2 11 10 %e A341910 4 5 100 101 %e A341910 5 7 101 111 %e A341910 6 6 110 110 %e A341910 7 4 111 100 %e A341910 8 9 1000 1001 %e A341910 9 11 1001 1011 %e A341910 10 15 1010 1111 %t A341910 Block[{a = {0}, k}, Do[k = 1; While[Nand[FreeQ[a, k], DigitCount[k, 2, 1] == #], k++] &@ Length[Split@ IntegerDigits[i, 2]]; AppendTo[a, k], {i, 67}]; a] (* _Michael De Vlieger_, Feb 24 2021 *) %o A341910 (PARI) See Links section. %Y A341910 Cf. A000120, A005811, A037481, A298847, A341911 (inverse). %K A341910 nonn,look,base %O A341910 0,3 %A A341910 _Rémy Sigrist_, Feb 23 2021