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.

Previous Showing 11-20 of 30 results. Next

A384878 Position of first appearance of n in the flattened version of the triangle A384877, whose m-th row lists the lengths of maximal anti-runs in the binary indices of m.

Original entry on oeis.org

1, 6, 34, 178, 882, 4210, 19570, 89202, 400498, 1776754
Offset: 1

Views

Author

Gus Wiseman, Jun 23 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 set of binary indices of each nonnegative integer and its partition into anti-runs begins:
  0: {}      {{}}
  1: {1}     {{1}}
  2: {2}     {{2}}
  3: {1,2}   {{1},{2}}
  4: {3}     {{3}}
  5: {1,3}   {{1,3}}
  6: {2,3}   {{2},{3}}
  7: {1,2,3} {{1},{2},{3}}
The flattened version begins: {}, {1}, {2}, {1}, {2}, {3}, {1,3}, {2}, {3}, {1}, {2}, {3}. Of these sets, the first of length 2 is the sixth (starting with 0), so we have a(2) = 6.
		

Crossrefs

For runs instead of anti-runs we have A001792.
The unflattened version is A052499.
Positions of first appearances in A384877, see A000120, A245562, A245563, A384890.
A023758 lists differences of powers of 2.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    mnrm[s_]:=If[Min@@s==1,mnrm[DeleteCases[s-1,0]]+1,0];
    q=Join@@Table[Length/@Split[bpe[n],#2!=#1+1&],{n,0,100}];
    Table[Position[q,i][[1,1]],{i,mnrm[q]}]

A329767 Triangle read by rows where T(n,k) is the number of binary words of length n >= 0 with runs-resistance k, 0 <= k <= n.

Original entry on oeis.org

1, 2, 0, 0, 2, 2, 0, 2, 2, 4, 0, 2, 4, 6, 4, 0, 2, 2, 12, 12, 4, 0, 2, 6, 30, 18, 8, 0, 0, 2, 2, 44, 44, 32, 4, 0, 0, 2, 6, 82, 76, 74, 16, 0, 0, 0, 2, 4, 144, 138, 172, 52, 0, 0, 0, 0, 2, 6, 258, 248, 350, 156, 4, 0, 0, 0, 0, 2, 2, 426, 452, 734, 404, 28, 0, 0, 0, 0
Offset: 0

Views

Author

Gus Wiseman, Nov 21 2019

Keywords

Comments

A composition of n is a finite sequence of positive integers with sum n.
For the operation of taking the sequence of run-lengths of a finite sequence, runs-resistance is defined as the number of applications required to reach a singleton.
Except for the k = 0 column and the n = 0 and n = 1 rows, this is the triangle appearing on page 3 of Lenormand, which is A319411. Unlike A318928, we do not here require that a(n) >= 1.
The n = 0 row is chosen to ensure that the row-sums are A000079, although the empty word arguably has indeterminate runs-resistance.

Examples

			Triangle begins:
   1
   2   0
   0   2   2
   0   2   2   4
   0   2   4   6   4
   0   2   2  12  12   4
   0   2   6  30  18   8   0
   0   2   2  44  44  32   4   0
   0   2   6  82  76  74  16   0   0
   0   2   4 144 138 172  52   0   0   0
   0   2   6 258 248 350 156   4   0   0   0
   0   2   2 426 452 734 404  28   0   0   0   0
For example, row n = 4 counts the following words:
  0000  0011  0001  0010
  1111  0101  0110  0100
        1010  0111  1011
        1100  1000  1101
              1001
              1110
		

Crossrefs

Row sums are A000079.
Column k = 2 is A319410.
Column k = 3 is 2 * A329745.
The version for compositions is A329744.
The version for partitions is A329746.
The number of nonzero entries in row n > 0 is A319412(n).
The runs-resistance of the binary expansion of n is A318928.

Programs

  • Mathematica
    runsres[q_]:=If[Length[q]==1,0,Length[NestWhileList[Length/@Split[#]&,q,Length[#]>1&]]-1];
    Table[Length[Select[Tuples[{0,1},n],runsres[#]==k&]],{n,0,10},{k,0,n}]

A200649 Number of 1's in the Stolarsky representation of n.

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Nov 19 2011

Keywords

Comments

For the Stolarsky representation of n, see the C. Mongoven link.
Conjecture: a(n) is the length of row n-1 of A385886. To obtain it, first take maximal anti-run lengths of binary indices of each nonnegative integer (giving A384877), then remove all duplicate rows (giving A385886), and finally take the length of each remaining row. For sum instead of length we appear to have A200648. For runs minus 1 instead of anti-runs see A200650. - Gus Wiseman, Jul 21 2025

Examples

			The Stolarsky representation of 19 is 11101. This has 4 1's. So a(19) = 4.
		

Crossrefs

For length instead of number of 1's we have A200648.
For 0's instead of 1's we have A200650.
Stolarsky representation is listed by A385888, ranks A200714.
A000120 counts 1's in binary expansion.
A384877 lists anti-run lengths of binary indices, duplicates removed A385886.
A384890 counts maximal anti-runs of binary indices, ranked by A385816.

Programs

  • Mathematica
    stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
    a[n_] := Count[stol[n], 1]; Array[a, 100] (* Amiram Eldar, Jul 07 2023 *)
  • PARI
    stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1])));}
    a(n) = vecsum(stol(n)); \\ Amiram Eldar, Jul 07 2023

Formula

a(n) = a(n - A130312(n-1)) + (A072649(n-1) - A072649(n - A130312(n-1) - 1)) mod 2 for n > 2 with a(1) = 0, a(2) = 1. - Mikhail Kurkov, Oct 19 2021 [verification needed]
a(n) = A200648(n) - A200650(n). - Amiram Eldar, Jul 07 2023

Extensions

More terms from Amiram Eldar, Jul 07 2023

A200648 Length of Stolarsky representation of n.

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Nov 19 2011

Keywords

Comments

For the Stolarsky representation of n, see the C. Mongoven link.
Conjecture: a(n) is the sum of row n-1 of A385886. To obtain it, first take maximal anti-run lengths of binary indices of each nonnegative integer (giving A384877), then remove all duplicate rows (giving A385886), and finally take the sum of each remaining row. For length instead of sum we appear to have A200649. - Gus Wiseman, Jul 21 2025

Examples

			The Stolarsky representation of 19 is 11101. This is of length 5. So a(19) = 5.
		

Crossrefs

Counting just ones gives A200649.
Counting just zeros gives A200650.
Stolarsky representation is listed by A385888, ranks A200714.
A000120 counts 1's in binary expansion.
A384890 counts maximal anti-runs of binary indices, ranks A385816.
A385886 lists maximal anti-run lengths of binary indices.

Programs

  • Mathematica
    stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
    a[n_] := If[n == 1, 1, Length[stol[n]]]; Array[a, 100] (* Amiram Eldar, Jul 07 2023 *)
  • PARI
    stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1])));}
    a(n) = if(n == 1, 1, #stol(n)); \\ Amiram Eldar, Jul 07 2023

Formula

a(n) = A200649(n) + A200650(n). - Michel Marcus, Mar 14 2023

Extensions

More terms from Amiram Eldar, Jul 07 2023

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&]&]

A200650 Number of 0's in Stolarsky representation of n.

Original entry on oeis.org

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

Views

Author

Casey Mongoven, Nov 19 2011

Keywords

Comments

For the Stolarsky representation of n, see the C. Mongoven link.
a(n+1), n >= 1, gives the size of the n-th generation of each of the "[male-female] pair of Fibonacci rabbits" in the Fibonacci rabbits tree read right-to-left by row, the first pair (the root) being the 0th generation. (Cf. OEIS Wiki link below.) - Daniel Forgues, May 07 2015
From Daniel Forgues, May 07 2015: (Start)
Concatenation of:
0: 1,
1: 0,
2: 0,
3: 1, 0,
4: 1, 1, 0,
5: 2, 1, 1, 1, 0,
6: 2, 2, 1, 2, 1, 1, 1, 0,
(...),
where row n, n >= 3, is row n-1 prepended by incremented row n-2. (End)
For n >= 3, this algorithm yields the next F_n terms of the sequence, where F_n is the n-th Fibonacci number (A000045). Since it is asymptotic to (phi^n)/sqrt(5), the number of terms thus obtained grows exponentially at each step! - Daniel Forgues, May 22 2015
Conjecture: a(n) is one less than the length of row n-1 of A385817. To obtain it, first take maximal run lengths of binary indices of each nonnegative integer (giving A245563), then remove all duplicate rows (giving A385817), and finally take the length of each remaining row and subtract 1. For sum instead of length we appear to have A200648. For anti-runs instead of runs we appear to have A341259 = A200649-1. - Gus Wiseman, Jul 21 2025
How is this related to A117479? - R. J. Mathar, Aug 10 2025

Examples

			The Stolarsky representation of 19 is 11101. This has one 0. So a(19) = 1.
		

Crossrefs

For length instead of number of 0's we have A200648.
For sum (or number of 1's) instead of number of 0's we have A200649.
Stolarsky representation is listed by A385888, ranks A200714.
A000120 counts 1's in binary expansion, 0's A023416.
A069010 counts maximal runs of binary indices, ranked by A385889.
A245563 lists maximal run lengths of binary indices, duplicates removed A385817.

Programs

  • Mathematica
    stol[n_] := stol[n] = If[n == 1, {}, If[n != Round[Round[n/GoldenRatio]*GoldenRatio], Join[stol[Floor[n/GoldenRatio^2] + 1], {0}], Join[stol[Round[n/GoldenRatio]], {1}]]];
    a[n_] := If[n == 1, 1, Count[stol[n], 0]]; Array[a, 100] (* Amiram Eldar, Jul 07 2023 *)
  • PARI
    stol(n) = {my(phi=quadgen(5)); if(n==1, [], if(n != round(round(n/phi)*phi), concat(stol(floor(n/phi^2) + 1), [0]), concat(stol(round(n/phi)), [1])));}
    a(n) = if(n == 1, 1,  my(s = stol(n)); #s - vecsum(s)); \\ Amiram Eldar, Jul 07 2023

Formula

a(n) = A200648(n) - A200649(n). - Amiram Eldar, Jul 07 2023

Extensions

Corrected and extended by Kenny Lau, Jul 04 2016

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}]

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}]]

A202064 Triangle T(n,k), read by rows, given by (2, -1/2, 1/2, 0, 0, 0, 0, 0, 0, 0, ...) DELTA (0, 1/2, -1/2, 0, 0, 0, 0, 0, 0, 0, ...) where DELTA is the operator defined in A084938.

Original entry on oeis.org

1, 2, 0, 3, 1, 0, 4, 4, 0, 0, 5, 10, 1, 0, 0, 6, 20, 6, 0, 0, 0, 7, 35, 21, 1, 0, 0, 0, 8, 56, 56, 8, 0, 0, 0, 0, 9, 84, 126, 36, 1, 0, 0, 0, 0, 10, 120, 252, 120, 10, 0, 0, 0, 0, 0, 11, 165, 462, 330, 55, 1, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Dec 10 2011

Keywords

Comments

Riordan array (x/(1-x)^2, x^2/(1-x)^2).
Mirror image of triangle in A119900.
A203322*A130595 as infinite lower triangular matrices. - Philippe Deléham, Jan 05 2011
From Gus Wiseman, Jul 07 2025: (Start)
Also the number of subsets of {1..n} containing n with k maximal runs (sequences of consecutive elements increasing by 1). For example, row n = 5 counts the following subsets:
{5} {1,5} {1,3,5}
{4,5} {2,5}
{3,4,5} {3,5}
{2,3,4,5} {1,2,5}
{1,2,3,4,5} {1,4,5}
{2,3,5}
{2,4,5}
{1,2,3,5}
{1,2,4,5}
{1,3,4,5}
For anti-runs instead of runs we have A053538.
Without requiring n see A210039, A202023, reverse A098158, A109446.
(End)

Examples

			Triangle begins :
1
2, 0
3, 1, 0
4, 4, 0, 0
5, 10, 1, 0, 0
6, 20, 6, 0, 0, 0
7, 35, 21, 1, 0, 0, 0
8, 56, 56, 8, 0, 0, 0, 0
		

Crossrefs

Cf. A007318, A005314 (antidiagonal sums), A119900, A084938, A130595, A203322.
Column k = 1 is A000027.
Row sums are A000079.
Column k = 2 is A000292.
Without zeros we have A034867.
Last nonzero term in each row appears to be A124625.
A034839 counts subsets by number of maximal runs, for anti-runs A384893.
A116674 counts strict partitions by number of maximal runs, for anti-runs A384905.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&Length[Split[#,#2==#1+1&]]==k&]],{n,12},{k,n}] (* Gus Wiseman, Jul 07 2025 *)

Formula

G.f.: 1/((1-x)^2-y*x^2).
Sum_{k, 0<=k<=n} T(n,k)*x^k = A000027(n+1), A000079(n), A000129(n+1), A002605(n+1), A015518(n+1), A063727(n), A002532(n+1), A083099(n+1), A015519(n+1), A003683(n+1), A002534(n+1), A083102(n), A015520(n+1), A091914(n) for x = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 10, 11, 12, 13 respectively.
T(n,k) = binomial(n+1,2k+1).
T(n,k) = 2*T(n-1,k) + T(n-2,k-1) - T(n-2,k), T(0,0) = 1, T(1,0) = 2, T(1,1) = 0 and T(n,k) = 0 if k<0 or if k>n. - Philippe Deléham, Mar 15 2012

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)).
Previous Showing 11-20 of 30 results. Next