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 A337242 #32 Aug 23 2020 20:51:38 %S A337242 0,1,2,3,6,5,4,7,14,13,10,11,12,9,8,15,30,29,26,27,22,21,20,23,28,25, %T A337242 18,19,24,17,16,31,62,61,58,59,54,53,52,57,46,45,42,43,50,41,40,47,60, %U A337242 55,44,51,38,37,36,49,56,39,34,35,48,33,32,63,126,125,122 %N A337242 a(n) is the greatest number m not yet in the sequence such that the binary expansions of m and of n have the same run lengths (up to order but with multiplicity). %C A337242 This sequence has similarities with A331274; here we consider run lengths in binary expansions, there binary digits. %C A337242 This sequence is a self-inverse permutation of the nonnegative numbers. %C A337242 This sequence preserves the number of binary digits (A070939) and the number of runs in binary expansions (A005811). %C A337242 This sequence has interesting graphical features (see Links section). %H A337242 Rémy Sigrist, <a href="/A337242/b337242.txt">Table of n, a(n) for n = 0..8191</a> %H A337242 Rémy Sigrist, <a href="/A337242/a337242.png">Scatterplot of the first 2^20 terms</a> %H A337242 Rémy Sigrist, <a href="/A337242/a337242_1.png">Scatterplot of (n-2^19, a(n)-2^19) for n = 2^19..2^20-1</a> %H A337242 Rémy Sigrist, <a href="/A337242/a337242.gp.txt">PARI program for A337242</a> %H A337242 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A337242 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A337242 a(2^k-1) = 2^k-1 for any k >= 0. %e A337242 For n = 7280: %e A337242 - 7280 has binary expansion "1110001110000", %e A337242 - the corresponding run lengths are: {3, 3, 3, 4}, %e A337242 - there are four numbers k with the same multiset of run lengths: %e A337242 k bin(k) run lengths %e A337242 ---- --------------- ----------- %e A337242 7224 "1110000111000" {3, 4, 3, 3} %e A337242 7280 "1110001110000" {3, 3, 3, 4} %e A337242 7288 "1110001111000" {3, 3, 4, 3} %e A337242 7736 "1111000111000" {4, 3, 3, 3} %e A337242 - so a(7224) = 7736, %e A337242 a(7280) = 7288, %e A337242 a(7288) = 7280, %e A337242 a(7736) = 7224. %t A337242 Nest[Function[{a, m}, Append[a, SelectFirst[m, FreeQ[a, #] &]]] @@ {#1, Sort[Map[FromDigits[Join @@ MapIndexed[ConstantArray[Boole[OddQ@ First[#2]], #1] &, #], 2] &, Permutations[Length /@ Split@ IntegerDigits[#2, 2]]], Greater]} & @@ {#, Length@ #} &, {0}, 66] (* _Michael De Vlieger_, Aug 22 2020 *) %o A337242 (PARI) See Links section. %Y A337242 Cf. A005811, A070939, A101211, A331274, A335834, A335835. %K A337242 nonn,look,base %O A337242 0,3 %A A337242 _Rémy Sigrist_, Aug 21 2020