login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A341911 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of ones in the binary expansion of n equals the number of runs in the binary expansion of a(n). 2

%I #15 Feb 24 2021 16:25:31

%S 0,1,3,2,7,4,6,5,15,8,12,9,14,11,13,10,31,16,24,17,28,19,23,18,30,25,

%T 27,20,29,22,26,21,63,32,48,33,56,35,39,34,60,47,49,36,51,38,40,37,62,

%U 55,57,44,59,46,50,41,61,52,54,43,58,45,53,42,127,64,96

%N Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, the number of ones in the binary expansion of n equals the number of runs in the binary expansion of a(n).

%C This sequence is a permutation of the nonnegative integers with inverse A341910.

%H Rémy Sigrist, <a href="/A341911/b341911.txt">Table of n, a(n) for n = 0..8191</a>

%H Rémy Sigrist, <a href="/A341911/a341911.png">Colored scatterplot of the first 2^16 terms</a> (where the color is function of A000120(n))

%H Rémy Sigrist, <a href="/A341911/a341911.gp.txt">PARI program for A341911</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F A000120(n) = A005811(a(n)).

%F a(n) < 2^k for any n < 2^k.

%e The first terms, in decimal and in binary, are:

%e n a(n) bin(n) bin(a(n))

%e -- ---- ------- ---------

%e 0 0 0 0

%e 1 1 1 1

%e 2 3 10 11

%e 3 2 11 10

%e 4 7 100 111

%e 5 4 101 100

%e 6 6 110 110

%e 7 5 111 101

%e 8 15 1000 1111

%e 9 8 1001 1000

%e 10 12 1010 1100

%t Block[{a = {0}, k}, Do[k = 1; While[Nand[FreeQ[a, k], Length[Split@ IntegerDigits[k, 2]] == #], k++] &@ DigitCount[i, 2, 1]; AppendTo[a, k], {i, 66}]; a] (* _Michael De Vlieger_, Feb 24 2021 *)

%o (PARI) See Links section.

%Y Cf. A000120, A005811, A298847, A341910 (inverse).

%K nonn,look,base

%O 0,3

%A _Rémy Sigrist_, Feb 23 2021

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 31 13:44 EDT 2024. Contains 375567 sequences. (Running on oeis4.)