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.

Showing 1-10 of 20 results. Next

A384893 Triangle read by rows where T(n,k) is the number of subsets of {1..n} with k maximal anti-runs (increasing by more than 1).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 4, 2, 1, 1, 7, 5, 2, 1, 1, 12, 10, 6, 2, 1, 1, 20, 20, 13, 7, 2, 1, 1, 33, 38, 29, 16, 8, 2, 1, 1, 54, 71, 60, 39, 19, 9, 2, 1, 1, 88, 130, 122, 86, 50, 22, 10, 2, 1, 1, 143, 235, 241, 187, 116, 62, 25, 11, 2, 1, 1, 232, 420, 468, 392, 267, 150, 75, 28, 12, 2, 1
Offset: 0

Views

Author

Gus Wiseman, Jun 21 2025

Keywords

Examples

			The subset {3,6,7,9,11,12} has maximal anti-runs ((3,6),(7,9,11),(12)), so is counted under T(12,3).
The subset {3,6,7,9,10,12} has maximal anti-runs ((3,6),(7,9),(10,12)), so is counted under T(12,3).
Row n = 5 counts the following subsets:
  {}  {1}      {1,2}    {1,2,3}    {1,2,3,4}  {1,2,3,4,5}
      {2}      {2,3}    {2,3,4}    {2,3,4,5}
      {3}      {3,4}    {3,4,5}
      {4}      {4,5}    {1,2,3,5}
      {5}      {1,2,4}  {1,2,4,5}
      {1,3}    {1,2,5}  {1,3,4,5}
      {1,4}    {1,3,4}
      {1,5}    {1,4,5}
      {2,4}    {2,3,5}
      {2,5}    {2,4,5}
      {3,5}
      {1,3,5}
Triangle begins:
   1
   1   1
   1   2   1
   1   4   2   1
   1   7   5   2   1
   1  12  10   6   2   1
   1  20  20  13   7   2   1
   1  33  38  29  16   8   2   1
   1  54  71  60  39  19   9   2   1
   1  88 130 122  86  50  22  10   2   1
   1 143 235 241 187 116  62  25  11   2   1
   1 232 420 468 392 267 150  75  28  12   2   1
   1 376 744 894 806 588 363 188  89  31  13   2   1
		

Crossrefs

Column k = 1 is A000071.
Row sums are A000079.
Column k = 2 is A001629.
For runs instead of anti-runs we have A034839, for strict partitions A116674.
The case containing n is A053538.
For integer partitions instead of subsets we have A268193, strict A384905.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.
A384877 gives lengths of maximal anti-runs in binary indices, firsts A384878.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],Length[Split[#,#2!=#1+1&]]==k&]],{n,0,10},{k,0,n}]

A384890 Number of maximal anti-runs (increasing by more than 1) in the binary indices of n.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 4, 5, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 3, 2, 2, 3, 4, 3, 3, 3, 4, 4, 4, 5, 6, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 2, 1, 1, 2
Offset: 0

Views

Author

Gus Wiseman, Jun 17 2025

Keywords

Comments

First differs from A272604 at a(51) = 3, A272604(51) = 2.
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.
Do all constant runs in this sequence have lengths 1, 2, or 3?

Examples

			The binary indices of 51 are {1,2,5,6}, with maximal anti-runs ((1),(2,5),(6)), so a(51) = 3.
		

Crossrefs

For runs instead of anti-runs we have A069010 = run-lengths of A245563 (reverse A245562).
Row-lengths of A384877, firsts A384878.
For prime indices instead of binary indices we have A384906.
A000120 counts binary indices.
A356606 counts strict partitions without a neighborless part, complement A356607.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Length[Split[bpe[n],#2!=#1+1&]],{n,0,100}]

A384905 Triangle read by rows where T(n,k) is the number of strict integer partitions of n with k maximal anti-runs (decreasing by more than 1).

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 2, 0, 0, 0, 0, 2, 1, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 0, 0, 0, 0, 5, 2, 1, 0, 0, 0, 0, 0, 0, 0, 6, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 7, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Gus Wiseman, Jun 21 2025

Keywords

Examples

			The T(10,2) = 3 strict partitions with 2 maximal anti-runs are: (7,2,1), (5,4,1), (5,3,2).
Triangle begins:
  1
  0  1
  0  1  0
  0  1  1  0
  0  2  0  0  0
  0  2  1  0  0  0
  0  3  0  1  0  0  0
  0  3  2  0  0  0  0  0
  0  4  2  0  0  0  0  0  0
  0  5  2  1  0  0  0  0  0  0
  0  6  3  0  1  0  0  0  0  0  0
  0  7  4  1  0  0  0  0  0  0  0  0
  0  9  3  3  0  0  0  0  0  0  0  0  0
		

Crossrefs

Row sums are A000009.
Column k = 1 is A003114.
For subsets instead of strict integer partitions see A053538, A119900, A210034.
For runs instead of anti-runs we have A116674, for subsets A034839.
This is the strict case of A268193.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.
A384877 gives lengths of maximal anti-runs in binary indices, firsts A384878.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&Length[Split[#,#1!=#2+1&]]==k&]],{n,0,10},{k,0,n}]

A384879 Numbers whose binary indices have all distinct lengths of maximal anti-runs (increasing by more than 1).

Original entry on oeis.org

1, 2, 4, 5, 8, 9, 10, 11, 13, 16, 17, 18, 19, 20, 21, 22, 25, 26, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 49, 50, 52, 53, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 88, 97, 98, 100, 101, 104, 105, 106, 128, 129, 130
Offset: 1

Views

Author

Gus Wiseman, Jun 17 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.

Examples

			The binary indices of 813 are {1,3,4,6,9,10}, with maximal anti-runs ((1,3),(4,6,9),(10)), with lengths (2,3,1), so 813 is in the sequence.
The terms together with their binary expansions and binary indices begin:
    1:       1 ~ {1}
    2:      10 ~ {2}
    4:     100 ~ {3}
    5:     101 ~ {1,3}
    8:    1000 ~ {4}
    9:    1001 ~ {1,4}
   10:    1010 ~ {2,4}
   11:    1011 ~ {1,2,4}
   13:    1101 ~ {1,3,4}
   16:   10000 ~ {5}
   17:   10001 ~ {1,5}
   18:   10010 ~ {2,5}
   19:   10011 ~ {1,2,5}
   20:   10100 ~ {3,5}
   21:   10101 ~ {1,3,5}
   22:   10110 ~ {2,3,5}
   25:   11001 ~ {1,4,5}
   26:   11010 ~ {2,4,5}
		

Crossrefs

Subsets of this type are counted by A384177, for runs A384175 (complement A384176).
These are the indices of strict rows in A384877, see A384878, A245563, A245562, A246029.
A000120 counts binary indices.
A098859 counts Wilf partitions (distinct multiplicities), complement A336866.
A356606 counts strict partitions without a neighborless part, complement A356607.
A384890 counts maximal anti-runs in binary indices, runs A069010.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Select[Range[100],UnsameQ@@Length/@Split[bpe[#],#2!=#1+1&]&]

A053538 Triangle: a(n,m) = ways to place p balls in n slots with m in the rightmost p slots, 0<=p<=n, 0<=m<=n, summed over p, a(n,m)= Sum_{k=0..n} binomial(k,m)*binomial(n-k,k-m), (see program line).

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 5, 5, 4, 1, 1, 8, 10, 7, 5, 1, 1, 13, 18, 16, 9, 6, 1, 1, 21, 33, 31, 23, 11, 7, 1, 1, 34, 59, 62, 47, 31, 13, 8, 1, 1, 55, 105, 119, 101, 66, 40, 15, 9, 1, 1, 89, 185, 227, 205, 151, 88, 50, 17, 10, 1, 1, 144, 324, 426, 414, 321, 213, 113, 61, 19, 11, 1, 1
Offset: 0

Views

Author

Wouter Meeussen, May 23 2001

Keywords

Comments

Riordan array (1/(1-x-x^2), x(1-x)/(1-x-x^2)). Row sums are A000079. Diagonal sums are A006053(n+2). - Paul Barry, Nov 01 2006
Subtriangle of the triangle given by (0, 1, 1, -1, 0, 0, 0, 0, 0, 0, 0, ...) DELTA (1, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, ...) where DELTA is the operator defined in A084938. - Philippe Deléham, Mar 05 2012
Mirror image of triangle in A208342. - Philippe Deléham, Mar 05 2012
A053538 is jointly generated with A076791 as an array of coefficients of polynomials u(n,x): initially, u(1,x)=v(1,x)=1, for n>1, u(n,x) = x*u(n-1,x) + v(n-1,x) and v(n,x) = u(n-1,x) + v(n-1,x). See the Mathematica section at A076791. - Clark Kimberling, Mar 08 2012
The matrix inverse starts
1;
-1, 1;
-1, -1, 1;
1, -2, -1, 1;
3, 1, -3, -1, 1;
1, 6, 1, -4, -1, 1;
-7, 4, 10, 1, -5, -1, 1;
-13, -13, 8, 15, 1, -6, -1, 1;
3, -31, -23, 13, 21, 1, -7, -1, 1; - R. J. Mathar, Mar 15 2013
Also appears to be the number of subsets of {1..n} containing n with k maximal anti-runs of consecutive elements increasing by more than 1. For example, the subset {1,3,6,7,11,12} has maximal anti-runs ((1,3,6),(7,11),(12)) so is counted under a(12,3). For runs instead of anti-runs we get A202064. - Gus Wiseman, Jun 26 2025

Examples

			n=4; Table[binomial[k, j]binomial[n-k, k-j], {k, 0, n}, {j, 0, n}] splits {1, 4, 6, 4, 1} into {{1, 0, 0, 0, 0}, {3, 1, 0, 0, 0}, {1, 4, 1, 0, 0}, {0, 0, 3, 1, 0}, {0, 0, 0, 0, 1}} and this gives summed by columns {5, 5, 4, 1, 1}
Triangle begins :
   1;
   1,  1;
   2,  1,  1;
   3,  3,  1, 1;
   5,  5,  4, 1, 1;
   8, 10,  7, 5, 1, 1;
  13, 18, 16, 9, 6, 1, 1;
...
(0, 1, 1, -1, 0, 0, 0, ...) DELTA (1, 0, -1, 1, 0, 0, 0, ...) begins :
  1;
  0,  1;
  0,  1,  1;
  0,  2,  1,  1;
  0,  3,  3,  1, 1;
  0,  5,  5,  4, 1, 1;
  0,  8, 10,  7, 5, 1, 1;
  0, 13, 18, 16, 9, 6, 1, 1;
		

Crossrefs

Column k = 1 is A000045.
Row sums are A000079.
Column k = 2 is A010049.
For runs instead of anti-runs we have A202064.
For integer partitions see A268193, strict A384905, runs A116674.
A034839 counts subsets by number of maximal runs.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.
A384877 gives lengths of maximal anti-runs in binary indices, firsts A384878.
A384893 counts subsets by number of maximal anti-runs.

Programs

  • GAP
    Flat(List([0..12], n-> List([0..n], k-> Sum([0..n], j->  Binomial(j,k)*Binomial(n-j,j-k)) ))); # G. C. Greubel, May 16 2019
  • Magma
    [[(&+[Binomial(j,k)*Binomial(n-j,j-k): j in [0..n]]): k in [0..n]]: n in [0..12]]; // G. C. Greubel, May 16 2019
    
  • Maple
    a:= (n, m)-> add(binomial(k, m)*binomial(n-k, k-m), k=0..n):
    seq(seq(a(n,m), m=0..n), n=0..12);  # Alois P. Heinz, Sep 19 2013
  • Mathematica
    Table[Sum[Binomial[k, m]*Binomial[n-k, k-m], {k,0,n}], {n,0,12}, {m,0,n}]
  • PARI
    {T(n,k) = sum(j=0,n, binomial(j,k)*binomial(n-j,j-k))}; \\ G. C. Greubel, May 16 2019
    
  • Sage
    [[sum(binomial(j,k)*binomial(n-j,j-k) for j in (0..n)) for k in (0..n)] for n in (0..12)] # G. C. Greubel, May 16 2019
    

Formula

From Philippe Deléham, Mar 05 2012: (Start)
T(n,k) = T(n-1,k) + T(n-1,k-1) + T(n-2,k) - T(n-2,k-1), T(0,0) = T(1,0) = T(1,1) = 1 and T(n,k) = 0 if k<0 or if k>n.
G.f.: 1/(1-(1+y)*x-(1-y)*x^2).
Sum_{k, 0<=k<=n} T(n,k)*x^k = A077957(n), A000045(n+1), A000079(n), A001906(n+1), A007070(n), A116415(n), A084326(n+1), A190974(n+1), A190978(n+1), A190984(n+1), A190990(n+1), A190872(n+1) for x = -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 respectively. (End)

A385816 The number k such that the k-th composition in standard order lists the maximal anti-run lengths of the binary indices of n. Standard composition number of row n of A384877.

Original entry on oeis.org

0, 1, 1, 3, 1, 2, 3, 7, 1, 2, 2, 6, 3, 5, 7, 15, 1, 2, 2, 6, 2, 4, 6, 14, 3, 5, 5, 13, 7, 11, 15, 31, 1, 2, 2, 6, 2, 4, 6, 14, 2, 4, 4, 12, 6, 10, 14, 30, 3, 5, 5, 13, 5, 9, 13, 29, 7, 11, 11, 27, 15, 23, 31, 63, 1, 2, 2, 6, 2, 4, 6, 14, 2, 4, 4, 12, 6, 10, 14
Offset: 0

Views

Author

Gus Wiseman, Jul 15 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.
If the k-th composition in standard order is y, then the standard composition number of y is defined to be k.

Examples

			The binary indices of 181 are {1,3,5,6,8}, with maximal anti-runs ((1,3,5),(6,8)), with lengths (3,2), which is the 18th composition in standard order, so a(181) = 18.
		

Crossrefs

The reverse version is A209859.
Sorted positions of first appearances are A247648.
These are standard composition numbers of rows of A384877 (duplicates removed A385886).
For runs instead of anti-runs the reverse is A385887 (duplicates removed A232559).
For runs instead of anti-runs we have A385889 (duplicates removed A385818).
A245563 lists run lengths of binary indices (ranks A246029), reverse A245562.

Programs

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

A210034 Triangle of coefficients of polynomials v(n,x) jointly generated with A210033; see the Formula section.

Original entry on oeis.org

1, 2, 1, 4, 2, 1, 7, 5, 2, 1, 12, 10, 6, 2, 1, 20, 20, 13, 7, 2, 1, 33, 38, 29, 16, 8, 2, 1, 54, 71, 60, 39, 19, 9, 2, 1, 88, 130, 122, 86, 50, 22, 10, 2, 1, 143, 235, 241, 187, 116, 62, 25, 11, 2, 1, 232, 420, 468, 392, 267, 150, 75, 28, 12, 2, 1, 376, 744, 894, 806
Offset: 1

Views

Author

Clark Kimberling, Mar 16 2012

Keywords

Comments

For a discussion and guide to related arrays, see A208510.
From Gus Wiseman, Jun 29 2025: (Start)
This appears to be the number of subsets of {1..n} with k>0 maximal anti-runs (sequences of consecutive elements increasing by more than 1). For example, the subset {1,2,4,5} has maximal anti-runs ((1),(2,4),(5)) so is counted under T(5,3). Row n = 5 counts the following:
{1} {1,2} {1,2,3} {1,2,3,4} {1,2,3,4,5}
{2} {2,3} {2,3,4} {2,3,4,5}
{3} {3,4} {3,4,5}
{4} {4,5} {1,2,3,5}
{5} {1,2,4} {1,2,4,5}
{1,3} {1,2,5} {1,3,4,5}
{1,4} {1,3,4}
{1,5} {1,4,5}
{2,4} {2,3,5}
{2,5} {2,4,5}
{3,5}
{1,3,5}
For runs instead of anti-runs we have A034839, with n A202064. For reversed partitions instead of subsets we have A268193. (End)

Examples

			First five rows:
  1
  2    1
  4    2    1
  7    5    2   1
  12   10   6   2   1
First three polynomials v(n,x): 1, 2 + x, 4 + 2*x + x^2.
		

Crossrefs

Column k = 1 is A000071.
Row sums are A000225.
Column k = 2 is A001629.
Column k = 3 is A055243.
The version including k = 0 is A384893.
A034839 counts subsets by number of maximal runs, see also A202023, A202064.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.
A384877 gives lengths of maximal anti-runs of binary indices, firsts A384878.

Programs

  • Mathematica
    u[1, x_] := 1; v[1, x_] := 1; z = 16;
    u[n_, x_] := u[n - 1, x] + v[n - 1, x] + 1;
    v[n_, x_] := u[n - 1, x] + x*v[n - 1, x] + 1;
    Table[Expand[u[n, x]], {n, 1, z/2}]
    Table[Expand[v[n, x]], {n, 1, z/2}]
    cu = Table[CoefficientList[u[n, x], x], {n, 1, z}];
    TableForm[cu]
    Flatten[%]    (* A210033 *)
    Table[Expand[v[n, x]], {n, 1, z}]
    cv = Table[CoefficientList[v[n, x], x], {n, 1, z}];
    TableForm[cv]
    Flatten[%]    (* A210034 *)

Formula

u(n,x)=u(n-1,x)+v(n-1,x)+1,
v(n,x)=u(n-1,x)+x*v(n-1,x)+1,
where u(1,x)=1, v(1,x)=1.

A385886 Irregular triangle read by rows listing the lengths of maximal anti-runs (sequences of distinct consecutive elements increasing by more than 1) of binary indices, duplicate rows removed.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 3, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 2, 3, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 3, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 2, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1
Offset: 0

Views

Author

Gus Wiseman, Jul 14 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.
This is the triangle A384877, except all duplicates after the first instance of each composition are removed. It lists all compositions in order of their first appearance as a row of A384877.

Examples

			The binary indices of 27 are {1,2,4,5}, with maximal anti-runs ((1),(2,4),(5)), with lengths (1,2,1). After removing duplicates, this is our row 10.
The binary indices of 53 are {1,3,5,6}, with maximal anti-runs ((1,3,5),(6)), with lengths (3,1). After removing duplicates, this is our row 16.
Triangle begins:
   0: .
   1: 1
   2: 1 1
   3: 2
   4: 1 1 1
   5: 1 2
   6: 2 1
   7: 1 1 1 1
   8: 3
   9: 1 1 2
  10: 1 2 1
  11: 2 1 1
  12: 1 1 1 1 1
  13: 1 3
  14: 2 2
  15: 1 1 1 2
  16: 3 1
  17: 1 1 2 1
  18: 1 2 1 1
  19: 2 1 1 1
  20: 1 1 1 1 1 1
		

Crossrefs

In the following references, "before" is short for "before removing duplicate rows".
Positions of singleton rows appear to be A001906 = A055588 - 1.
Positions of rows of the form (1,1,...) appear to be A001911-2, before A023758.
Row sums appear to be A200648, before A000120.
Row lengths appear to be A200649, before A384890.
Standard composition numbers of each row appear to be A348366.
Before we had A384877, ranks A385816, firsts A052499.
For runs instead of anti-runs we have A385817, see A245563, A245562, A246029.

Programs

  • Mathematica
    DeleteDuplicates[Table[Length/@Split[Join@@Position[Reverse[IntegerDigits[n,2]],1],#2!=#1+1&],{n,0,100}]]

A209859 Rewrite the binary expansion of n from the most significant end, 1 -> 1, 0+1 (one or more zeros followed by one) -> 0, drop the trailing zeros of the original n.

Original entry on oeis.org

0, 1, 1, 3, 1, 2, 3, 7, 1, 2, 2, 5, 3, 6, 7, 15, 1, 2, 2, 5, 2, 4, 5, 11, 3, 6, 6, 13, 7, 14, 15, 31, 1, 2, 2, 5, 2, 4, 5, 11, 2, 4, 4, 9, 5, 10, 11, 23, 3, 6, 6, 13, 6, 12, 13, 27, 7, 14, 14, 29, 15, 30, 31, 63, 1, 2, 2, 5, 2, 4, 5, 11, 2, 4, 4, 9, 5, 10, 11, 23, 2, 4, 4, 9, 4, 8, 9, 19, 5, 10, 10, 21, 11, 22, 23, 47, 3, 6, 6, 13, 6, 12, 13, 27, 6, 12, 12, 25, 13
Offset: 0

Views

Author

Antti Karttunen, Mar 24 2012

Keywords

Comments

This is the number k such that the k-th composition in standard order is the reversed sequence of lengths of the maximal anti-runs of the binary indices of n. Here, the binary indices of n are row n of A048793, and the k-th composition in standard order is row k of A066099. For example, the binary indices of 100 are {3,6,7}, with maximal anti-runs ((3,6),(7)), with reversed lengths (1,2), which is the 6th composition in standard order, so a(100) = 6. - Gus Wiseman, Jul 27 2025

Examples

			102 in binary is 1100110, we rewrite it from the left so that first two 1's stay same ("11"), then "001" is rewritten to "0", the last 1 to "1", and we ignore the last 0, thus getting 1101, which is binary expansion of 13, thus a(102) = 13.
		

Crossrefs

This is an "inverse" of A071162, i.e. a(A071162(n)) = n for all n. Bisection: A209639. Used to construct permutation A209862.
Removing duplicates appears to give A358654.
Sorted positions of firsts appearances appear to be A247648+1.
A245563 lists run-lengths of binary indices (ranks A246029), reverse A245562.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    stcinv[q_]:=Total[2^(Accumulate[Reverse[q]])]/2;
    Table[stcinv[Reverse[Length/@Split[bpe[n],#2!=#1+1&]]],{n,0,100}] (* Gus Wiseman, Jul 25 2025 *)
  • Python
    import re
    def a(n): return int(re.sub("0+1", "0", bin(n)[2:].rstrip("0")), 2) if n else 0
    print([a(n) for n in range(109)])  # Michael S. Branicky, Jul 25 2025
  • Scheme
    (define (A209859 n) (let loop ((n n) (s 0) (i (A053644 n))) (cond ((zero? n) s) ((> i n) (if (> (/ i 2) n) (loop n s (/ i 2)) (loop (- n (/ i 2)) (* 2 s) (/ i 4)))) (else (loop (- n i) (+ (* 2 s) 1) (/ i 2))))))
    

Formula

a(n) = a(A000265(n)).

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}]
Showing 1-10 of 20 results. Next