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 14 results. Next

A296658 Length of the standard Lyndon word factorization of the first n terms of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Dec 18 2017

Keywords

Examples

			The standard Lyndon word factorization of (12211212212211211) is (122)(112122122)(112)(1)(1), so a(17) = 5.
The standard factorizations of initial terms of A000002:
1
12
122
122,1
122,1,1
122,112
122,112,1
122,11212
122,112122
122,112122,1
122,11212212
122,112122122
122,112122122,1
122,112122122,1,1
122,112122122,112
122,112122122,112,1
122,112122122,112,1,1
122,112122122,112,112
122,112122122,1121122
122,112122122,1121122,1
		

Crossrefs

Programs

  • Mathematica
    LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
    qit[q_]:=If[#===Length[q],{q},Prepend[qit[Drop[q,#]],Take[q,#]]]&[Max@@Select[Range[Length[q]],LyndonQ[Take[q,#]]&]];
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],Part[q,-2],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]];
    Table[Length[qit[Nest[kolagrow,1,n]]],{n,150}]

A329314 Irregular triangle read by rows where row n gives the lengths of the components in the Lyndon factorization of the binary expansion of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Equivalently, a Lyndon word is a finite sequence that is lexicographically strictly less than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).

Examples

			Triangle begins:
   0: ()         20: (1211)      40: (12111)     60: (111111)
   1: (1)        21: (122)       41: (123)       61: (11112)
   2: (11)       22: (131)       42: (1221)      62: (111111)
   3: (11)       23: (14)        43: (15)        63: (111111)
   4: (111)      24: (11111)     44: (1311)      64: (1111111)
   5: (12)       25: (113)       45: (132)       65: (16)
   6: (111)      26: (1121)      46: (141)       66: (151)
   7: (111)      27: (113)       47: (15)        67: (16)
   8: (1111)     28: (11111)     48: (111111)    68: (1411)
   9: (13)       29: (1112)      49: (114)       69: (16)
  10: (121)      30: (11111)     50: (1131)      70: (151)
  11: (13)       31: (11111)     51: (114)       71: (16)
  12: (1111)     32: (111111)    52: (11211)     72: (13111)
  13: (112)      33: (15)        53: (1122)      73: (133)
  14: (1111)     34: (141)       54: (1131)      74: (151)
  15: (1111)     35: (15)        55: (114)       75: (16)
  16: (11111)    36: (1311)      56: (111111)    76: (1411)
  17: (14)       37: (15)        57: (1113)      77: (16)
  18: (131)      38: (141)       58: (11121)     78: (151)
  19: (14)       39: (15)        59: (1113)      79: (16)
		

Crossrefs

Row lengths are A211100.
Row sums are A029837, or, if the first term is 1, A070939.
Ignoring the first digit gives A329325.
Positions of rows of length 2 are A329327.
Binary Lyndon words are counted by A001037 and ranked by A102659.
Numbers whose reversed binary expansion is a Lyndon word are A328596.
Length of the co-Lyndon factorization of the binary expansion is A329312.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#1]]&]]]];
    Table[Length/@lynfac[If[n==0,{},IntegerDigits[n,2]]],{n,0,50}]

A329325 Irregular triangle read by rows where row n gives the lengths of the components in the Lyndon factorization of the binary expansion of n with first digit removed.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).

Examples

			Triangle begins:
   1: ()        21: (22)       41: (23)       61: (1112)
   2: (1)       22: (31)       42: (221)      62: (11111)
   3: (1)       23: (4)        43: (5)        63: (11111)
   4: (11)      24: (1111)     44: (311)      64: (111111)
   5: (2)       25: (13)       45: (32)       65: (6)
   6: (11)      26: (121)      46: (41)       66: (51)
   7: (11)      27: (13)       47: (5)        67: (6)
   8: (111)     28: (1111)     48: (11111)    68: (411)
   9: (3)       29: (112)      49: (14)       69: (6)
  10: (21)      30: (1111)     50: (131)      70: (51)
  11: (3)       31: (1111)     51: (14)       71: (6)
  12: (111)     32: (11111)    52: (1211)     72: (3111)
  13: (12)      33: (5)        53: (122)      73: (33)
  14: (111)     34: (41)       54: (131)      74: (51)
  15: (111)     35: (5)        55: (14)       75: (6)
  16: (1111)    36: (311)      56: (11111)    76: (411)
  17: (4)       37: (5)        57: (113)      77: (6)
  18: (31)      38: (41)       58: (1121)     78: (51)
  19: (4)       39: (5)        59: (113)      79: (6)
  20: (211)     40: (2111)     60: (11111)    80: (21111)
For example, the trimmed binary expansion of 41 is (01001), with Lyndon factorization (01)(001), so row 41 is {2,3}.
		

Crossrefs

Row lengths are A211097.
Row sums are A000523.
Keeping the first digit gives A329314.
Positions of singleton rows are A329327.
Binary Lyndon words are counted by A001037 and ranked by A102659.
Numbers whose reversed binary expansion is a Lyndon word are A328596.
Length of the co-Lyndon factorization of the binary expansion is A329312.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#1]]&]]]];
    Table[Length/@lynfac[Rest[IntegerDigits[n,2]]],{n,100}]

A329317 Length of the Lyndon factorization of the reversed first n terms of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Equivalently, a Lyndon word is a finite sequence that is lexicographically strictly less than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).

Examples

			The sequence of Lyndon factorizations of the reversed initial terms of A000002 begins:
   1: (1)
   2: (2)(1)
   3: (2)(2)(1)
   4: (122)(1)
   5: (1122)(1)
   6: (2)(1122)(1)
   7: (12)(1122)(1)
   8: (2)(12)(1122)(1)
   9: (2)(2)(12)(1122)(1)
  10: (122)(12)(1122)(1)
  11: (2)(122)(12)(1122)(1)
  12: (2)(2)(122)(12)(1122)(1)
  13: (122)(122)(12)(1122)(1)
  14: (112212212)(1122)(1)
  15: (2)(112212212)(1122)(1)
  16: (12)(112212212)(1122)(1)
  17: (1121122122121122)(1)
  18: (2)(1121122122121122)(1)
  19: (2)(2)(1121122122121122)(1)
  20: (122)(1121122122121122)(1)
For example, the reversed first 13 terms of A000002 are (1221221211221), with Lyndon factorization (122)(122)(12)(1122)(1), so a(13) = 5.
		

Crossrefs

Row-lengths of A329316.
The non-reversed version is A329315.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#]]&]]]];
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=Nest[kolagrow,{1},n-1];
    Table[Length[lynfac[Reverse[kol[n]]]],{n,100}]

A329316 Irregular triangle read by rows where row n gives the sequence of lengths of components of the Lyndon factorization of the reversed first n terms of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

There are no repeated rows, as row n has sum n.
We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Equivalently, a Lyndon word is a finite sequence that is lexicographically strictly less than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).
It appears that some numbers (such as 10) never appear in the sequence.

Examples

			Triangle begins:
   1: (1)
   2: (1,1)
   3: (1,1,1)
   4: (3,1)
   5: (4,1)
   6: (1,4,1)
   7: (2,4,1)
   8: (1,2,4,1)
   9: (1,1,2,4,1)
  10: (3,2,4,1)
  11: (1,3,2,4,1)
  12: (1,1,3,2,4,1)
  13: (3,3,2,4,1)
  14: (9,4,1)
  15: (1,9,4,1)
  16: (2,9,4,1)
  17: (16,1)
  18: (1,16,1)
  19: (1,1,16,1)
  20: (3,16,1)
For example, the reversed first 13 terms of A000002 are (1221221211221), with Lyndon factorization (122)(122)(12)(1122)(1), so row 13 is (3,3,2,4,1).
		

Crossrefs

Row lengths are A329317.
The non-reversed version is A329315.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#]]&]]]];
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=Nest[kolagrow,{1},n-1];
    Table[Length/@lynfac[Reverse[kol[n]]],{n,100}]

A329362 Length of the co-Lyndon factorization of the first n terms of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 12 2019

Keywords

Comments

The co-Lyndon product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling the sequences together. For example, the co-Lyndon product of (231) and (213) is (212313), the product of (221) and (213) is (212213), and the product of (122) and (2121) is (1212122). A co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product. Equivalently, a co-Lyndon word is a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into co-Lyndon words, and if these factors are arranged in a certain order, their concatenation is equal to their co-Lyndon product. For example, (1001) has sorted co-Lyndon factorization (1)(100).

Examples

			The co-Lyndon factorizations of the initial terms of A000002:
                      () = 0
                     (1) = (1)
                    (12) = (1)(2)
                   (122) = (1)(2)(2)
                  (1221) = (1)(221)
                 (12211) = (1)(2211)
                (122112) = (1)(2211)(2)
               (1221121) = (1)(221121)
              (12211212) = (1)(221121)(2)
             (122112122) = (1)(221121)(2)(2)
            (1221121221) = (1)(221121)(221)
           (12211212212) = (1)(221121)(221)(2)
          (122112122122) = (1)(221121)(221)(2)(2)
         (1221121221221) = (1)(221121)(221)(221)
        (12211212212211) = (1)(221121)(2212211)
       (122112122122112) = (1)(221121)(2212211)(2)
      (1221121221221121) = (1)(221121)(221221121)
     (12211212212211211) = (1)(221121)(2212211211)
    (122112122122112112) = (1)(221121)(2212211211)(2)
   (1221121221221121122) = (1)(221121)(2212211211)(2)(2)
  (12211212212211211221) = (1)(221121)(2212211211)(221)
		

Crossrefs

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=If[n==0,{},Nest[kolagrow,{1},n-1]];
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    colynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[colynfac[Drop[q,i]],Take[q,i]]]@Last[Select[Range[Length[q]],colynQ[Take[q,#]]&]]];
    Table[Length[colynfac[kol[n]]],{n,0,100}]

A332273 Sizes of maximal weakly decreasing subsequences of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Mar 08 2020

Keywords

Examples

			The weakly decreasing subsequences begin: (1), (2,2,1,1), (2,1), (2,2,1), (2,2,1,1), (2,1,1), (2,2,1), (2,1,1), (2,1), (2,2,1,1), (2,1,1), (2,1), (2,2,1), (2,2,1,1).
		

Crossrefs

The number of runs in the first n terms of A000002 is A156253.
The weakly increasing version is A332875.

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=Nest[kolagrow,{1},n-1];
    Length/@Split[kol[40],#1>=#2&]

Formula

a(n) = A000002(2*n - 2) + A000002(2*n - 1) for n > 1.

A332875 Sizes of maximal weakly increasing subsequences of A000002.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Mar 08 2020

Keywords

Examples

			The weakly increasing subsequences begin: (1,2,2), (1,1,2), (1,2,2), (1,2,2), (1,1,2), (1,1,2,2), (1,2), (1,1,2), (1,2,2), (1,1,2), (1,1,2), (1,2,2), (1,2,2).
		

Crossrefs

The number of runs in the first n terms of A000002 is A156253.
The weakly decreasing version is A332273.

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=Nest[kolagrow,{1},n-1];
    Length/@Split[kol[40],#1<=#2&]

Formula

a(n) = A000002(2*n - 1) + A000002(2*n).

A329355 The binary expansion of a(n) is the second through n-th terms of A000002 - 1.

Original entry on oeis.org

0, 1, 3, 6, 12, 25, 50, 101, 203, 406, 813, 1627, 3254, 6508, 13017, 26034, 52068, 104137, 208275, 416550, 833101, 1666202, 3332404, 6664809, 13329618, 26659237, 53318475, 106636950, 213273900, 426547801, 853095602, 1706191204, 3412382409, 6824764818
Offset: 1

Views

Author

Gus Wiseman, Nov 12 2019

Keywords

Examples

			a(11) = 813 has binary expansion q = {1, 1, 0, 0, 1, 0, 1, 1, 0, 1}, and q + 1 is {2, 2, 1, 1, 2, 1, 2, 2, 1, 2}, which is the second through 11th terms of A000002.
		

Crossrefs

Replacing "A000002 - 1" with "2 - A000002" gives A329356.
Partial sums of A000002 are A054353.
Initial subsequences of A000002 are A329360.

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=If[n==0,{},Nest[kolagrow,{1},n-1]];
    Table[FromDigits[kol[n]-1,2],{n,30}]

A329356 The binary expansion of a(n) is the first n terms of 2 - A000002.

Original entry on oeis.org

0, 1, 2, 4, 9, 19, 38, 77, 154, 308, 617, 1234, 2468, 4937, 9875, 19750, 39501, 79003, 158006, 316012, 632025, 1264050, 2528101, 5056203, 10112406, 20224813, 40449626, 80899252, 161798505, 323597011, 647194022, 1294388045, 2588776091, 5177552182, 10355104365
Offset: 0

Views

Author

Gus Wiseman, Nov 12 2019

Keywords

Examples

			a(7) = 77 has binary expansion q = {1, 0, 0, 1, 1, 0, 1}, and 2 - q is {1, 2, 2, 1, 1, 2, 1}, which is the first 7 terms of A000002.
		

Crossrefs

Replacing "2 - A000002" with "A000002 - 1" gives A329355.
Initial subsequences of A000002 are A329360.

Programs

  • Mathematica
    kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
    kol[n_Integer]:=If[n==0,{},Nest[kolagrow,{1},n-1]];
    Table[FromDigits[2-kol[n],2],{n,0,30}]

Formula

a(n) = floor((1-c/2)*2^n), where c = A118270 is the Kolakoski constant. - Lorenzo Sauras Altuzarra, Jan 01 2023
Showing 1-10 of 14 results. Next