cp's OEIS Frontend

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.

A385889 The number k such that the k-th composition in standard order is the sequence of lengths of maximal runs of binary indices of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 3, 2, 4, 1, 3, 3, 5, 2, 6, 4, 8, 1, 3, 3, 5, 3, 7, 5, 9, 2, 6, 6, 10, 4, 12, 8, 16, 1, 3, 3, 5, 3, 7, 5, 9, 3, 7, 7, 11, 5, 13, 9, 17, 2, 6, 6, 10, 6, 14, 10, 18, 4, 12, 12, 20, 8, 24, 16, 32, 1, 3, 3, 5, 3, 7, 5, 9, 3, 7, 7, 11, 5, 13, 9, 17, 3
Offset: 0

Views

Author

Gus Wiseman, Jul 16 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.
The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.

Examples

			The binary indices of 27 are {1,2,4,5}, with maximal runs ((1,2),(4,5)), with lengths (2,2), which is the 10th composition in standard order, so a(27) = 10.
The binary indices of 100 are {3,6,7}, with maximal runs ((3),(6,7)), with lengths (1,2), which is the 6th composition in standard order, so a(100) = 6.
		

Crossrefs

Sorted positions of firsts appearances appear to be A247648+1.
After removing duplicates we get A385818.
The reverse version is A385887.
A245563 lists run lengths of binary indices (ranks A246029), reverse A245562.
A384877 lists anti-run lengths of binary indices (ranks A385816), reverse A209859.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2;
    Table[stcinv[Length/@Split[bpe[n],#2==#1+1&]],{n,0,100}]