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 A337304 #18 Aug 25 2020 22:46:18 %S A337304 0,1,2,3,4,5,6,7,8,9,10,13,12,11,14,15,16,17,20,25,18,21,26,29,24,19, %T A337304 22,27,28,23,30,31,32,33,40,49,36,41,52,57,34,37,42,53,50,45,58,61,48, %U A337304 35,44,51,38,43,54,59,56,39,46,55,60,47,62,63,64,65,80,97 %N A337304 a(n) is the greatest number m not yet in the sequence such that the binary expansions of n and of m have the same runs of consecutive equal digits (up to order but with multiplicity). %C A337304 This sequence has similarities with A337242; here we consider runs, there run lengths. %C A337304 This sequence is a self-inverse permutation of the nonnegative integers. %C A337304 This sequence preserves the Hamming weight (A000120), the number of binary digits (A070939) and the number of runs in binary expansions (A005811). %H A337304 Rémy Sigrist, <a href="/A337304/b337304.txt">Table of n, a(n) for n = 0..8192</a> %H A337304 Rémy Sigrist, <a href="/A337304/a337304.gp.txt">PARI program for A337304</a> %H A337304 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %H A337304 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A337304 a(2^k) = 2^k for any k >= 0. %F A337304 a(2^k-1) = 2^k-1 for any k >= 0. %e A337304 For n = 303: %e A337304 - the binary expansion of 43 is "100101111", %e A337304 - the corresponding runs of consecutive equals digits are "1", "00", "1", "0", "1111", %e A337304 - there are six numbers k with the same multiset of runs: %e A337304 k bin(k) %e A337304 --- ----------- %e A337304 303 "100101111" %e A337304 317 "100111101" %e A337304 335 "101001111" %e A337304 377 "101111001" %e A337304 485 "111100101" %e A337304 489 "111101001" %e A337304 - so a(303) = 489, %e A337304 a(317) = 485, %e A337304 a(335) = 377, %e A337304 a(377) = 335, %e A337304 a(485) = 317, %e A337304 a(489) = 303. %o A337304 (PARI) See Links section. %Y A337304 Cf. A000120, A005811, A070939, A337242. %K A337304 nonn,look,base %O A337304 0,3 %A A337304 _Rémy Sigrist_, Aug 22 2020