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-7 of 7 results.

A187180 Parse the infinite string 0101010101... into distinct phrases 0, 1, 01, 010, 10, ...; a(n) = length of n-th phrase.

Original entry on oeis.org

1, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, 6, 7, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12, 13, 14, 15, 14, 15, 16, 17, 16, 17, 18, 19, 18, 19, 20, 21, 20, 21, 22, 23, 22, 23, 24, 25, 24, 25, 26, 27, 26, 27, 28, 29, 28, 29, 30, 31, 30, 31, 32, 33, 32, 33, 34, 35, 34, 35, 36, 37, 36, 37, 38, 39, 38, 39, 40, 41, 40, 41, 42, 43, 42, 43, 44, 45, 44, 45, 46, 47, 46, 47, 48, 49, 48, 49, 50, 51, 50, 51, 52, 53, 52, 53, 54, 55, 54, 55, 56, 57, 56, 57, 58, 59, 58, 59, 60, 61
Offset: 1

Views

Author

N. J. A. Sloane, Mar 06 2011

Keywords

Examples

			The sequence begins
   1   1
   2   3   2   3
   4   5   4   5
   6   7   6   7
   8   9   8   9
  10  11  10  11 ...
		

Crossrefs

See A187180-A187188 for alphabets of size 2 through 10.
Essentially the same as A106249 and A018837.

Programs

  • Maple
    1,1,seq(op(2*i*[1,1,1,1]+[0,1,0,1]), i=1..100); # Robert Israel, Oct 15 2015
  • Mathematica
    Join[{1},LinearRecurrence[{1, 0, 0, 1, -1},{1, 2, 3, 2, 3},119]] (* Ray Chandler, Aug 26 2015 *)
    CoefficientList[Series[(x^5 - 2 x^4 + x^3 + x^2 + 1)/((x - 1)^2 (x + 1) (x^2 + 1)), {x, 0, 150}], x] (* Vincenzo Librandi, Oct 16 2015 *)
  • PARI
    a(n) = if(n==1, 1, (1 + (-1)^n + (1-I)*(-I)^n + (1+I)*I^n + 2*n) / 4); \\ Colin Barker, Oct 15 2015
    
  • PARI
    Vec(x*(x^5-2*x^4+x^3+x^2+1) / ((x-1)^2*(x+1)*(x^2+1)) + O(x^100)) \\ Colin Barker, Oct 15 2015

Formula

Consider more generally the string 012...k012...k012...k012...k01... with an alphabet of size B, where k = B-1. The sequence begins with B 1's, and thereafter is quasi-periodic with period B^2, and increases by B in each period.
For the present example, where B=2, the sequence begins with two 1's and thereafter increases by 2 in each block of 4: (1,1) (2,3,2,3), (4,5,4,5), (6,7,6,7), ...
From Colin Barker, Oct 15 2015: (Start)
a(n) = (1+(-1)^n+(1-i)*(-i)^n+(1+i)*i^n+2*n)/4 for n>1, where i = sqrt(-1).
G.f.: x*(x^5-2*x^4+x^3+x^2+1) / ((x-1)^2*(x+1)*(x^2+1)). (End)
From Wesley Ivan Hurt, May 03 2021: (Start)
a(n) = a(n-1)+a(n-4)-a(n-5).
a(n) = floor((n+1+(-1)^floor((n+1)/2))/2) for n > 1. (End)

A187188 Parse the infinite string 0123456789012345678901234567890... into distinct phrases 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 01, 23, 45, 67, 89, 012, 34, 56, 78, 90, 12, 345, ...; a(n) = length of n-th phrase.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 5, 6, 5, 5, 6, 5, 5, 6, 5, 5, 6, 5, 5, 6, 7, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12
Offset: 1

Views

Author

N. J. A. Sloane, Mar 06 2011

Keywords

Comments

See A187180-A187187 for further details.
Answers a question raised by Sergio Verdu (personal communication, Mar 05 2011).

Examples

			The sequence begins
1   1   1   1   1   1   1   1   1   1
2   2   2   2   2   3   2   2   2   2   2   3
3   3   3   3   3   3   3   3
4   4   4   4   4   5   4   4   4   4   4   5
6   5   5   6   5   5   6   5   5   6   5   5
6   7
6   6   6   6   6
7   7   7   7   7   7   7   7   7
8   8   8   8   8   9   8   8   8   8   8   9
9   9   9   9   9   9   9   9
10  11  10  11  10  11  10  11  10  11 10  11  10  11  10  11  10  11  10  11
12  12  12  12  12  13  12  12  12  12  12  13
...
		

Crossrefs

See A187180-A187188 for alphabets of size 2 through 10.
See also A109337, A187199, A187200.

Formula

After the initial block of 10 1's, the sequence is quasi-periodic with period 100, increasing by 10 after each block. In more detail:
a(n) = 1 for 1 <= n <= 10.
For n >= 10, write n = 11 + 100i + j with i >= 0, 0 <= j <= 99.
Then for 0 <= j <= 79, a(n) = 10i + f(j),
where f(0) ... f(79) is the following 80-term sequence:
[2 2 2 2 2 3 2 2 2 2 2 3
3 3 3 3 3 3 3 3
4 4 4 4 4 5 4 4 4 4 4 5
6 5 5 6 5 5 6 5 5 6 5 5
6 7
6 6 6 6 6
7 7 7 7 7 7 7 7 7
8 8 8 8 8 9 8 8 8 8 8 9
9 9 9 9 9 9 9 9]
(this has been broken into blocks to make it easier to see),
and for 80 <= j <= 99, a(n) = 10i+10 if j is even, a(n) = 10i+11 if j is odd.
Examples:
n=120 = 11 + 100*1 + 9, i=1, j=9, a(120)=10+f(9) = 10+2 = 12
n=292 = 11 + 100*2 + 81, i=2, j=81. a(292)=20+11=31

A109337 Parse the Thue-Morse sequence (A010060) using the Ziv-Lempel encoding as described in A106182; sequence gives lengths of successive phrases.

Original entry on oeis.org

1, 1, 2, 3, 2, 2, 3, 4, 2, 3, 3, 5, 3, 3, 4, 4, 4, 5, 4, 4, 6, 5, 6, 4, 4, 5, 6, 7, 5, 7, 6, 5, 4, 7, 6, 7, 5, 7, 5, 6, 7, 6, 6, 8, 5, 8, 4, 6, 7, 5, 8, 5, 6, 7, 6, 9, 7, 8, 6, 5, 8, 6, 7, 7, 7, 6, 8, 8, 8, 9, 7, 10, 6, 9, 9, 7, 8, 10, 8, 8, 9, 8, 9, 8, 9, 7, 9, 8, 7, 10, 9, 10, 8, 9, 7, 8, 9, 8, 9, 11, 9, 11
Offset: 1

Views

Author

N. J. A. Sloane, Aug 24 2005

Keywords

Examples

			The parsing into phrases gives 0, 1, 10, 100, 11, 00, 101, 1010, 01, 011, 001, 10100, ... with lengths 1,1,2,3,2,2,3,4,2,3,3,5,...
		

Crossrefs

Extensions

Terms a(13)-a(102) from John W. Layman, Sep 16 2010

A187200 Parse the Fibonacci word A003849 into distinct phrases 0, 1, 00, 10, 100, 1001, 01, 001, 010, ...; a(n) = length of n-th phrase.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 5, 4, 5, 5, 6, 6, 5, 5, 6, 6, 7, 7, 7, 8, 7, 6, 8, 9, 6, 6, 10, 7, 8, 8, 7, 8, 7, 11, 7, 9, 8, 9, 8, 10, 9, 8, 9, 8, 9, 9, 9, 12, 10, 10, 9, 10, 9, 11, 10, 13, 12, 10, 10, 11, 11, 11, 10, 11, 11, 14, 11, 12, 12, 11, 13, 10, 12, 12, 11, 12, 13, 12, 13, 14, 13, 11, 13, 14, 15, 14, 13, 16, 15, 12, 12, 17
Offset: 1

Views

Author

N. J. A. Sloane, Mar 06 2011

Keywords

Crossrefs

A187201 Parse Gijswijt's sequence A090822 into distinct phrases 1, 12, 11, 2, 22, 3, 112, 1122, 23, ...; a(n) = length of n-th phrase.

Original entry on oeis.org

1, 2, 2, 1, 2, 1, 3, 4, 2, 2, 3, 3, 3, 4, 3, 2, 3, 4, 3, 5, 4, 6, 3, 4, 4, 2, 7, 3, 4, 3, 5, 5, 5, 8, 3, 4, 5, 5, 5, 4, 2, 5, 5, 6, 4, 7, 4, 6, 5, 5, 6, 6, 6, 5, 4, 2, 8, 3, 7, 6, 6, 8, 6, 3, 9, 10, 10, 9, 7, 7, 9, 10, 10, 9, 7, 7, 6, 5, 4, 8, 10, 8, 8, 4, 7, 6, 3, 8, 5, 6, 9, 4, 7, 8, 10, 11, 11, 8, 9, 4
Offset: 1

Views

Author

N. J. A. Sloane, Mar 06 2011

Keywords

Crossrefs

A288533 Parse A004736 into distinct phrases [1], [2], [1,3], [2,1], [4], [3], [2,1,5], [4,3], [2,1,6], ...; a(n) is the length of the n-th phrase.

Original entry on oeis.org

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

Views

Author

Lewis Chen, Jun 11 2017

Keywords

Comments

The phrases are formed by the Ziv-Lempel encoding described in A106182. - Neal Gersh Tolunsky, Nov 30 2023

Examples

			Consider the infinite sequence [1,2,1,3,2,1,4,3,2,1,5,4,3,2,1,...], i.e., A004736. We can first take [1] since we've never used it before. Then [2]. For the third term, we've already used [1], so we must instead take [1,3].
		

Crossrefs

Programs

  • Python
    # you should use program from internal format
    a = set()
    i = 2
    s = "1"
    seq = ""
    while i < 100:
        j = i
        while j > 0:
            if s not in a:
                seq = seq + "," + str(len(s)-len(s.replace(",",""))+1)
                a.add(s)
                s = str(j)
            else:
                s = s + "," + str(j)
            j -= 1
        i += 1
    print(seq[1:])

A377648 Parse Golomb's sequence (A001462) into distinct phrases [1], [2], [2, 3], [3], [4], [4, 4], [5], [5, 5], ...; a(n) is the length of n-th phrase.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Nov 03 2024

Keywords

Comments

For any w > 0, we have some k such that a(k) = 1, a(k+1) = 2, ..., a(k+w-1) = w.

Examples

			The first terms, alongside the corresponding phrases, are:
  n   a(n)  Corresponding phrases
  --  ----  ---------------------
   1     1  1
   2     1  2
   3     2  2, 3
   4     1  3
   5     1  4
   6     2  4, 4
   7     1  5
   8     2  5, 5
   9     1  6
  10     2  6, 6
  11     2  6, 7
  12     1  7
  13     2  7, 7
  14     1  8
  15     2  8, 8
		

Crossrefs

See A187199 for a similar sequence.
Cf. A001462.

Programs

  • PARI
    \\ See Links section.
Showing 1-7 of 7 results.