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 A298847 #17 Jan 28 2018 13:34:36 %S A298847 1,3,2,7,5,6,4,15,11,13,9,14,10,12,8,31,23,27,19,29,21,22,17,30,25,26, %T A298847 18,28,20,24,16,63,47,55,39,59,43,45,35,61,46,51,37,53,38,41,33,62,54, %U A298847 57,42,58,44,49,34,60,50,52,36,56,40,48,32,127,95,111,79 %N A298847 Lexicographically earliest sequence of distinct positive terms such that, for any n > 0, the number of ones in the binary expansion of n equals one plus the number of zeros in the binary expansion of a(n). %C A298847 In other words, for any n > 0, A000120(n) = 1 + A023416(a(n)). %C A298847 This sequence is a self-inverse permutation of the natural numbers, with fixed points A031448. %C A298847 We can build an analog of this sequence for any base b > 1: %C A298847 - let s_b be the sum of digits in base b, %C A298847 - in particular s_2 = A000120 and s_10 = A007953, %C A298847 - let l_b be the number of digits in base b, %C A298847 - in particular l_2 = A070939 and l_10 = A055642, %C A298847 - let f_b be the lexicographically earliest sequence of distinct positive terms such that, for any n > 0, s_b(n) = 1 + (b-1) * l_b(a(n)) - s_b(a(n)), %C A298847 - in particular, f_2 = a (this sequence), %C A298847 - f_b is a self-inverse permutation of the natural numbers, %C A298847 - l_b(n) = l_b(f_b(n)) for any n > 0, %C A298847 - f_b(b^k) = b^(k+1) - 1 for any k >= 0, %C A298847 - see also scatterplots of f_3 and f_10 in Links section. %H A298847 Rémy Sigrist, <a href="/A298847/b298847.txt">Table of n, a(n) for n = 1..8191</a> %H A298847 Rémy Sigrist, <a href="/A298847/a298847.gp.txt">PARI program for A298847</a> %H A298847 Rémy Sigrist, <a href="/A298847/a298847.png">Colored scatterplot of the first 2^16 - 1 terms</a> (where the color is function of the Hamming weight of n) %H A298847 Rémy Sigrist, <a href="/A298847/a298847_1.png">Scatterplot of the first 3^9 - 1 terms of f_3</a> %H A298847 Rémy Sigrist, <a href="/A298847/a298847_2.png">Scatterplot of the first 10^4 - 1 terms of f_10</a> %H A298847 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A298847 A070939(n) = A070939(a(n)) for any n > 0. %F A298847 a(2^k) = 2^(k+1) - 1 for any k >= 0. %F A298847 A000120(n) + A000120(a(n)) = 1 + A070939(n) for any n > 0. %e A298847 The first terms, alongside the binary representations of n and of a(n), are: %e A298847 n a(n) bin(n) bin(a(n)) %e A298847 -- ---- ------ --------- %e A298847 1 1 1 1 %e A298847 2 3 10 11 %e A298847 3 2 11 10 %e A298847 4 7 100 111 %e A298847 5 5 101 101 %e A298847 6 6 110 110 %e A298847 7 4 111 100 %e A298847 8 15 1000 1111 %e A298847 9 11 1001 1011 %e A298847 10 13 1010 1101 %e A298847 11 9 1011 1001 %e A298847 12 14 1100 1110 %e A298847 13 10 1101 1010 %e A298847 14 12 1110 1100 %e A298847 15 8 1111 1000 %o A298847 (PARI) See Links section. %Y A298847 Cf. A000120, A007953, A023416, A031448, A055642, A070939. %K A298847 nonn,base %O A298847 1,2 %A A298847 _Rémy Sigrist_, Jan 27 2018