login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
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, 27, 20, 29, 22, 26, 21, 63, 32, 48, 33, 56, 35, 39, 34, 60, 47, 49, 36, 51, 38, 40, 37, 62, 55, 57, 44, 59, 46, 50, 41, 61, 52, 54, 43, 58, 45, 53, 42, 127, 64, 96
OFFSET
0,3
COMMENTS
This sequence is a permutation of the nonnegative integers with inverse A341910.
FORMULA
A000120(n) = A005811(a(n)).
a(n) < 2^k for any n < 2^k.
EXAMPLE
The first terms, in decimal and in binary, are:
n a(n) bin(n) bin(a(n))
-- ---- ------- ---------
0 0 0 0
1 1 1 1
2 3 10 11
3 2 11 10
4 7 100 111
5 4 101 100
6 6 110 110
7 5 111 101
8 15 1000 1111
9 8 1001 1000
10 12 1010 1100
MATHEMATICA
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 *)
PROG
(PARI) See Links section.
CROSSREFS
Cf. A000120, A005811, A298847, A341910 (inverse).
Sequence in context: A191664 A118319 A316385 * A341916 A360960 A371974
KEYWORD
nonn,look,base
AUTHOR
Rémy Sigrist, Feb 23 2021
STATUS
approved