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

A054352 Lengths of successive generations of the Kolakoski sequence A000002.

Original entry on oeis.org

1, 2, 4, 7, 11, 18, 28, 43, 65, 99, 150, 226, 340, 511, 768, 1153, 1728, 2590, 3885, 5826, 8742, 13116, 19674, 29514, 44280, 66431, 99667, 149531, 224306, 336450, 504648, 756961, 1135450, 1703197, 2554846, 3832292, 5748474, 8622646, 12933971, 19400955, 29101203
Offset: 0

Views

Author

N. J. A. Sloane, May 07 2000

Keywords

Comments

Starting with a(0) = 1, the first term of A000002, the n-th generation is the run of figures directly generated from the preceding generation completed with a single last figure which begins the next run. Thus a(0) = 1 -> 1-2 -> 1-22-1 -> 1-2211-2-1 etc. - Jean-Christophe Hervé, Oct 26 2014
It seems that the limit (c =) lim_{n -> oo} a(n)/(3/2)^n exists, with c = 2.63176..., so a(n) ~ (3/2)*a(n-1) ~ c * (3/2)^n, for large n. - A.H.M. Smeets, Apr 12 2024

Crossrefs

Programs

  • Mathematica
    A2 = {1, 2, 2}; Do[If[Mod[n, 10^5] == 0, Print["n = ", n]]; m = 1 + Mod[n - 1, 2]; an = A2[[n]]; A2 = Join[A2, Table[m, {an}]], {n, 3, 10^6}]; A054353 = Accumulate[A2]; Clear[a]; a[0] = 1; a[n_] := a[n] = A054353[[a[n - 1]]] + 1; Table[a[n], {n, 0, 33}] (* Jean-François Alcover, Oct 30 2014, after Jean-Christophe Hervé *)
  • Python
    def aupton(nn):
      alst, A054353, idx = [1], 0, 1
      K = Kolakoski()  # using Kolakoski() in A000002
      for n in range(2, nn+1):
        target = alst[-1]
        while idx <= target:
          A054353 += next(K)
          idx += 1
        alst.append(A054353 + 1)  # a(n) = A054353(a(n-1))+1
      return alst
    print(aupton(36))  # Michael S. Branicky, Jan 12 2021

Formula

a(0) = 1, and for n > 0, a(n) = A054353(a(n-1))+1. - Jean-Christophe Hervé, Oct 26 2014

Extensions

a(7)-a(32) from John W. Layman, Aug 20 2002
a(33) from Jean-François Alcover, Oct 30 2014
a(34) and beyond from Michael S. Branicky, Jan 12 2021

A249507 Length of full iterated word (direct branch and reverse branch) of the Kolakoski sequence A000002 initiated at A000002(n). If the reverse branch is longer than the direct branch, the total length is counted negatively: if A000002(n) = 2, a(n) = 0; if A000002(n) = 1, a(n) = (ld+lr-1)*sign(ld-lr) with ld = max { k | A000002(n-i+1) = A000002(i), 0A000002(n-i+1) = A000002(i), 0

Original entry on oeis.org

0, 0, -4, 2, 0, 5, 0, 0, 10, 0, 0, -4, 2, 0, -2, 4, 0, 0, -8, 0, -2, 2, 0, 8, 0, 0, -4, 2, 0, -2, 2, 0, 5, 0, 0, 14, 0, 0, -4, 2, 0, 5, 0, 0, -5, 0, -2, 2, 0, -2, 4, 0, 0, 24, 0, 0, -4, 2, 0, 5, 0, 0, 10, 0, 0, -4, 2, 0, -2, 2, 0, 5, 0, 0, -5, 0, -2, 4, 0, 0, 38, 0, 0, -4, 2, 0, 5
Offset: 2

Views

Author

Jean-Christophe Hervé, Oct 30 2014

Keywords

Comments

The Kolakoski sequence A000002 has a fractal structure that appears in the infinite number of iterations and reverse iterations of itself that it contains. Each iteration develops itself in two branches, a right branch in the direct sense, and a left branch in the reverse sense, e.g., 122-1-221121. This sequence gives the length of the full iterated word with its right and left branches starting at position n (with a length = 0 if A000002(n) = 2 <> A000002(1) = 1).
Each iterated word is generated by a preceding and shorter one, starting with 12 or 21 with the 1 in odd position. 12 for example gives, as long as the image of the initial 1 remains in odd position: 12 > 2-1-221 > 122-1-221121 > ... (21 generates the same succession with words in reverse order). The right branch is thus always formed by a term of A054351 (successive generations of the OK sequence), and the left branch by a term of the same sequence in reverse order.
The lengths of the 2 branches are never equal, because a fully symmetric iterated word would necessitate at the beginning the word 12121, which never appears in the OK sequence (it would need 111 before in the OK sequence to appear), but the 2 branches cannot differ by more than two successive generations, again because a greater difference would imply an impossible word at the beginning, namely 1-1221-1.
The iterated words are initiated by the 1's in the OK sequence, but the 1's in pairs 11 can only lead to very short iterated words: (1)-1-2(1) or (1)-1-221(2), or the same in reverse order, with values in this sequence of +/-2 or +/-4. On the contrary, each of the single 1's (212) in the OK sequence (except the first) is associated with an iterated word of length at least five, and (conjecture) it is likely that there is no bound to the length of iterated words associated with a single 1.
The number of iterated words with the right branch longer than the left seems to be well balanced, so that (conjecture) the limit of partial sums of this sequence could be o(n).

Examples

			The OK sequence begins as (highlighting the 10th term): 122112122-1-2211211221211... where the iterated word 122-1-221121 of length 10 can be seen around the 10th term; thus a(10) = 10.
		

Crossrefs

Formula

a(n) = (A249093(n) + A249094(n) - min(1, A249093(n))) * sign(A249093(n) - A249094(n)).

A249508 Lengths of complete iterations (direct and reverse branches) of the Kolakoski sequence A000002.

Original entry on oeis.org

2, 4, 5, 8, 10, 14, 17, 24, 28, 38, 45, 60, 70, 92, 107, 141, 163, 214, 248, 324, 375, 489, 565, 736, 850, 1107, 1278, 1663, 1920, 2495, 2880, 3742, 4317, 5612, 6474, 8415, 9710, 12626, 14567, 18941, 21857, 28415, 32789, 42629, 49187, 63953, 73793, 95944, 110710, 143946, 166097
Offset: 1

Views

Author

Jean-Christophe Hervé, Oct 30 2014

Keywords

Comments

See comments in A249507 for a description of iterated words in the Kolakoski sequence.

Examples

			The OK sequence begins as (highlighting an iteration of length 10): 122112-1221221121-1221211.., where iterations of length 2, 4, 5 and 8 can also be seen.
		

Crossrefs

Formula

a(2n+1) = A054352(n+1) + A054352(n) - 1;
a(2n+2) = A054352(n+2) + A054352(n) - 1.

A054349 Successive generations of the variant of the Kolakoski sequence described in A042942.

Original entry on oeis.org

2, 22, 2211, 221121, 221121221, 22112122122112, 2211212212211211221211, 221121221221121122121121221121121, 2211212212211211221211212211211212212211212212112
Offset: 0

Views

Author

N. J. A. Sloane, May 07 2000

Keywords

Comments

For n >= 0, let f_1(n) be the number of 1's in a(n) (sequence begins: 0, 0, 2, 3, 4, 6, 11, 17, 24, ...) and f_2(n) be the number of 2's (sequence begins: 1, 2, 2, 3, 5, 8, 11, 16, 25, ...). Then there is a simple relation between f_1 and f_2, namely: f_1(n) = 1 - f_2(n) + f_2(n-1) + f_2(n-2) + ... + f_2(0). i.e. f_1(7) = 17 and 1 - f_2(7) + f_2(6) + ... + f_2(0) = 1 - 16 + 11 + 8 + 5 + 3 + 2 + 2 + 1 = 17. - Benoit Cloitre, Oct 11 2005

Crossrefs

Word lengths give A042942.

Extensions

More terms from David Wasserman, Mar 04 2002

A249093 Length of self-iteration of the Kolakoski sequence A000002 starting at A000002(n): a(n) = max { k | A000002(n+i-1) = A000002(i), 0 < i <= k }.

Original entry on oeis.org

0, 0, 1, 2, 0, 4, 0, 0, 7, 0, 0, 1, 2, 0, 1, 4, 0, 0, 2, 0, 1, 2, 0, 7, 0, 0, 1, 2, 0, 1, 2, 0, 4, 0, 0, 11, 0, 0, 1, 2, 0, 4, 0, 0, 2, 0, 1, 2, 0, 1, 4, 0, 0, 18, 0, 0, 1, 2, 0, 4, 0, 0, 7, 0, 0, 1, 2, 0, 1, 2, 0, 4, 0, 0, 2, 0, 1, 4, 0, 0, 28, 0, 0, 1, 2, 0, 4
Offset: 2

Views

Author

Jean-Christophe Hervé, Oct 28 2014

Keywords

Comments

The Kolakoski sequence A000002 has a fractal structure that appears in the infinite number of iterations of itself that it contains. This sequence gives the length of the iteration starting at position n (with a length = 0 if A000002(n) = 2 <> A000002(1) = 1).
Recalling that A000002 begins as 1221121221..., the apparition of these iterations is easily understood from the evolution of an initial 2 in even position in A000002, which generates: 2 > (1)22(1) > (2)122112(1) > (1)221221121221(2)... (as long as the equivalent of the initial 2 in the successive iterates remains in even position). This example shows that the iterations are growing forward and backward in a symmetric pattern. The lengths of the backward iterations are in A249094 and the lengths of the full iterations with the two branches are in A249507.
Because each iteration must be generated by a preceding (and shorter) iteration, each branch is constituted of a term of A054351 (successive generations of the Kolakoski sequence), and the nonzero values of this sequence are all in A054352. That is, the only possible nonzero lengths of iterations are 1, 2, 4, 7, 11, ..., and a given value > 1 cannot appear in this sequence before the other smaller values.
Conjecture: for any k, there is an iteration of length A054352(k) in A000002.

Examples

			A000002(n) = 2 => a(n) = 0 since the Kolakoski sequence begins with 1. a(7) = 4 since A000002(7:10) = A000002(1:4) and A000002(11) <> A000002(5).
		

Crossrefs

A249094 Length of reverse self-iteration of the Kolakoski sequence A000002 starting at A000002(n): a(n) = max { k | A000002(n-i+1) = A000002(i), 0 < i <= k }.

Original entry on oeis.org

0, 0, 4, 1, 0, 2, 0, 0, 4, 0, 0, 4, 1, 0, 2, 1, 0, 0, 7, 0, 2, 1, 0, 2, 0, 0, 4, 1, 0, 2, 1, 0, 2, 0, 0, 4, 0, 0, 4, 1, 0, 2, 0, 0, 4, 0, 2, 1, 0, 2, 1, 0, 0, 7, 0, 0, 4, 1, 0, 2, 0, 0, 4, 0, 0, 4, 1, 0, 2, 1, 0, 2, 0, 0, 4, 0, 2, 1, 0, 0, 11, 0, 0, 4, 1, 0, 2
Offset: 2

Views

Author

Jean-Christophe Hervé, Oct 30 2014

Keywords

Comments

The Kolakoski sequence A000002 has a fractal structure that appears in the infinite number of iterations and reverse iterations of itself that it contains. Each iteration develops itself in two branches, a right branch in the direct sense, and a left branch in the reverse sense, e.g., 122-1-221121. This sequence gives the length of the reverse iteration (or left branch) starting at position n, with a length = 0 if A000002(n) = 2 <> A000002(1) = 1.
The lengths of the right branches are in A249093 and the lengths of the full iterations with the two branches are in A249507.
Recalling that A000002 begins as 1221121221..., the apparition of these iterations is easily understood from the evolution of an initial 2 in even position in A000002, which generates: 2 > (1)22(1) > (2)122112(1) > (1)221221121221(2)... (as long as the equivalent of the initial 2 in the successive iterates remains in even position).
Because each iteration must be generated by a preceding (and shorter) iteration, each branch is constituted of a term of A054351 (successive generations of the Kolakoski sequence) in reverse order for the left branches, and the nonzero values of this sequence are all in A054352. Any given value > 1 cannot appear in this sequence before the other smaller values.

Examples

			A000002(n) = 2 => a(n) = 0 since the Kolakoski sequence begins with 1. a(10) = 4 since A000002(7:10) = A000002(1:4) and A000002(6) <> A000002(5).
		

Crossrefs

A054350 Triangular array whose rows are successive generations of the Kolakoski sequence A000002.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 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, 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, 2, 1
Offset: 0

Views

Author

N. J. A. Sloane, May 07 2000

Keywords

Examples

			Triangle begins:
1;
1, 2;
1, 2, 2, 1;
1, 2, 2, 1, 1, 2, 1;
1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2;
1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2;
...
		

Crossrefs

Row lengths give A054352.

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 05 2003

A054348 Triangular array whose rows are successive generations of the variant of the Kolakoski sequence described in A042942.

Original entry on oeis.org

2, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 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
Offset: 0

Views

Author

N. J. A. Sloane, May 07 2000

Keywords

Examples

			Triangle begins:
2;
2, 2;
2, 2, 1, 1;
2, 2, 1, 1, 2, 1;
2, 2, 1, 1, 2, 1, 2, 2, 1;
2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2;
...
		

Crossrefs

Row lengths give A042942.

Extensions

More terms from David Wasserman, Mar 04 2002

A249942 Ranks of single 1's in the Kolakoski sequence A000002.

Original entry on oeis.org

7, 10, 20, 25, 34, 37, 43, 46, 55, 61, 64, 73, 76, 82, 88, 91, 101, 106, 109, 118, 128, 137, 143, 146, 152, 155, 164, 170, 173, 182, 187, 196, 199, 205, 211, 214, 223, 233, 236, 241, 251, 260, 263, 268, 277, 280, 286, 289, 298, 301, 307, 313, 316, 326, 331, 334
Offset: 1

Views

Author

Jean-Christophe Hervé, Nov 08 2014

Keywords

Comments

The single 1's whose ranks are given by this sequence are the 1's between two 2's in the OK sequence A000002. They are associated with iterated words of the OK sequence that develop themselves around each single 1 in two branches (for a description of the iterated words, see comments in A249507, which gives their lengths). The first term of A000002, which is indeed a single 1 but not between two 2's, is thus not considered here.
Each such single 1 is generated by a preceding 1 in the OK sequence that could be single or double, but each single 1 has a double 1 in its ancestors since the first 1 of the OK sequence has no descendants except itself. The length of the iterated word around a single 1 is linked to the number of generations between itself and its nearest double 1 ancestor (A249949 gives the number of generations of the n-th single 1).
A249948 gives the gaps between single 1's.

Crossrefs

Formula

a = {A054353(2k+1), k>1 and A000002(2k+1) = 1}.
Odd values of A216345: A216345(2k+1), k>0, such that A216345(2k+2) =
A216345(2k+1)+1.

A249948 Gaps between single 1's in the Kolakoski sequence A000002.

Original entry on oeis.org

6, 3, 10, 5, 9, 3, 6, 3, 9, 6, 3, 9, 3, 6, 6, 3, 10, 5, 3, 9, 10, 9, 6, 3, 6, 3, 9, 6, 3, 9, 5, 9, 3, 6, 6, 3, 9, 10, 3, 5, 10, 9, 3, 5, 9, 3, 6, 3, 9, 3, 6, 6, 3, 10, 5, 3, 6, 3, 6, 9, 3, 6, 3, 6, 3, 5, 10, 3, 9, 5, 3, 10, 9, 3, 5, 10, 3, 6, 6, 3, 10, 5, 9, 3, 10, 9, 3, 6, 6
Offset: 1

Views

Author

Jean-Christophe Hervé, Nov 09 2014

Keywords

Comments

Except the first term, equals first difference of A249942.
The only possible values are 3, 5, 6, 9 and 10: a(n) cannot take the value 2, because it would imply the word 21212 which does not appear in the OK sequence; a(n) = 3 with the word 212-212, a(n) = 5 with 212-11-212, a(n) = 6 with 212-211-212 or 212-112-212, a(n) = 9 with 212-211-211-212 or 212-112-112-212, a(n) = 10 with 212-2112112-212. And from this it is easily seen that a(n) and a(n+1) cannot be equal unless a(n) = a(n+1) = 6 with the word 21-21122-1-22112-12.

Crossrefs

Showing 1-10 of 11 results. Next