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

A090822 Gijswijt's sequence: a(1) = 1; for n>1, a(n) = largest integer k such that the word a(1)a(2)...a(n-1) is of the form xy^k for words x and y (where y has positive length), i.e., the maximal number of repeating blocks at the end of the sequence so far.

Original entry on oeis.org

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

Views

Author

Dion Gijswijt, Feb 27 2004

Keywords

Comments

Here xy^k means the concatenation of the words x and k copies of y.
The name "Gijswijt's sequence" is due to N. J. A. Sloane, not the author!
Fix n and suppose a(n) = k. Let len_y(n) = length of shortest y for this k and let len_x = n-1 - k*len_y(n) = corresponding length of x. A091407 and A091408 give len_y and len_x. For the subsequence when len_x = 0 see A091410 and A091411.
The first 4 occurs at a(220) (see A091409).
The first 5 appears around term 10^(10^23).
We believe that for all N >= 6, the first time N appears is at about position 2^(2^(3^(4^(5^...^(N-1))))). - N. J. A. Sloane and Allan Wilks, Mar 14 2004
For a similar formula, see p. 6 of Levi van de Pol article. - Levi van de Pol, Feb 06 2023
In the first 100000 terms the fraction of [1's, 2's, 3's, 4's] seems to converge, to about [.287, .530, .179, .005] respectively. - Allan Wilks, Mar 04 2004
When k=12 is reached, say, it is treated as the number 12, not as 1,2. This is not a base-dependent sequence.
Does this sequence have a finite average? Does anyone know the exact value? - Franklin T. Adams-Watters, Jan 23 2008
Answer: Given that "...the fraction of [1's, 2's, 3's, 4's] seems to converge, to about [.287, .530, .179, .005]..." that average should be the dot product of these vectors, i.e., about 1.904. - M. F. Hasler, Jan 24 2008
Second answer: The asymptotic densities of the numbers exist, and the average is the dot product. See pp. 56-59 of Levi van de Pol article. - Levi van de Pol, Feb 06 2023
Which is the first step with two consecutive 4's? Or the shortest run found so far between two 4's? - Sergio Pimentel, Oct 10 2016
Answer: The first x such that the x-th and (x+1)-th element are 4, is 255895648634818208370064452304769558261700170817472823... ...398081655524438021806620809813295008281436789493636144. See p. 55 of Levi van de Pol article. - Levi van de Pol, Feb 06 2023

References

  • N. J. A. Sloane, Seven Staggering Sequences, in Homage to a Pied Puzzler, E. Pegg Jr., A. H. Schoen and T. Rodgers (editors), A. K. Peters, Wellesley, MA, 2009, pp. 93-110.

Crossrefs

A091412 gives lengths of runs. A091413 gives partial sums.
Generalizations: A094781, A091975, A091976, A092331-A092335.

Programs

  • Haskell
    -- See link.
    
  • Maple
    K:= proc(L)
    local n,m,k,i,b;
    m:= 0;
    n:= nops(L);
    for k from 1 do
      if k*(m+1) > n then return(m) fi;
      b:= L[-k..-1];
      for i from 1 while i*k <= n and L[-i*k .. -(i-1)*k-1] = b do od:
      m:= max(m, i-1);
    od:
    end proc:
    A[1]:= 1:
    for i from 2 to 220 do
      A[i]:= K([seq(A[j],j=1..i-1)])
    od:
    seq(A[i],i=1..220); # Robert Israel, Jul 02 2015
  • Mathematica
    ClearAll[a]; reversed = {a[2]=1, a[1]=1}; blocs[len_] := Module[{bloc1, par, pos}, bloc1 = Take[reversed, len]; par = Partition[ reversed, len]; pos = Position[par, bloc_ /; bloc != bloc1, 1, 1]; If[pos == {}, Length[par], pos[[1, 1]] - 1]]; a[n_] := a[n] = Module[{an}, an = Table[{blocs[len], len}, {len, 1, Quotient[n-1, 2]}] // Sort // Last // First; PrependTo[ reversed, an]; an]; A090822 = Table[a[n], {n, 1, 99}] (* Jean-François Alcover, Aug 13 2012 *)
  • PARI
    A090822(n,A=[])={while(#Ak||break; k=m);A=concat(A,k));A} \\ M. F. Hasler, Aug 08 2018
    
  • Python
    def k(s):
        maxk = 1
        for m in range(1, len(s)+1):
            i, y, kk = 1, s[-m:], len(s)//m
            if kk <= maxk: return maxk
            while s[-(i+1)*m:-i*m] == y: i += 1
            maxk = max(maxk, i)
    def aupton(terms):
        alst = [1]
        for n in range(2, terms+1):
            alst.append(k(alst))
        return alst
    print(aupton(99)) # Michael S. Branicky, Mar 28 2022

A330005 a(n) counts the square-words immediately before a(n), with a(1) = 0.

Original entry on oeis.org

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

Views

Author

Eric Angelini and Jean-Marc Falcoz, Nov 26 2019

Keywords

Comments

Conjecture: Every integer will appear in the sequence. (Although very slowly: after 10000 terms, the biggest term is 5.)
Only the square-words are counted, not the cubes or the higher powers. The segment 1,1,1 will thus be followed by 0, and the same 0 will follow the segment 0,1,0,1,0,1,0,1 (because the pattern 0,1 is present four times instead of the required two, and because we don't accept splitting 0,1,0,1,0,1,0,1 in order to form two 0,1,0,1 substrings).
Overlaps are admitted: a typical case is the start with a(1) = 1. This produces 1,0,0,1,0,0,2,... with a(7) = 2 because there are indeed two squares immediately to the left of a(7): the square {0,0} and the square {100,100}.

Examples

			S = 0, ... We start with a(1) = 0 as this 0 means: "I don't see any square on my immediate left";
S = 0,0, ... We extend S with a(2) = 0 as this 0 says the same as above: "I don't see any square on my immediate left". Note that no other integer would fit without contradiction [a(2) = 1, for instance, would say that there is one square on the immediate left of "1", which is not the case - a lonely symbol cannot form a square].
S = 0,0,1, ... As we now see the square {00}, S is extended with a(3) = 1
S = 0,0,1,0, ... No square in sight, we thus extend S with a(4) = 0 [the word "immediate" is important: "There is no square on the immediate left of a(4) = 0"];
S = 0,0,1,0,0, ... No visible square again, so a(5) = 0;
S = 0,0,1,0,0,1, ... We see here that a(6) must be 1, as this "1" is immediately after the square {00}
S = 0,0,1,0,0,1,1, ... Yes: a(7) = 1 because a(7) sees 1 square on its immediate left, which is formed by {001,001};
S = 0,0,1,0,0,1,1,2, ... We see a third symbol entering S, the integer "2"; the reason is that 2 sees two squares on its immediate left, the first one being {11} and the second one {00} (again, the remote square {00} that opens S is not "immediately" to the left of 2, so we don't count it);
etc.
		

Crossrefs

Cf. A090822, A091970, A329447. The sequence A330023 does the same with cubes.

Programs

  • PARI
    A330005_upto(N,A=0)={for(n=2,#A=Vec(A,N), A[n]=sum(L=1,(n-1)\2, if(A[n-L..n-1]==A[n-L*2..n-L-1] &&(L*3>=n || A[n-L..n-1]!=A[n-L*3..n-L*2-1]), A[n-L*2+1]+1)));A} \\ Optional arg A specifies starting value. - M. F. Hasler, Nov 28 2019
Showing 1-2 of 2 results.