%I #32 Sep 30 2018 10:46:18
%S 4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,5,4,4,4,
%T 4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,5,4,4,4,4,4,5,
%U 4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,4,4,4,4,4,5,5,4,4,4,4,4,5
%N a(1) = 4. To get a(n+1), write the string a(1)a(2)...a(n) as xy^k for words x and y (where y has positive length) and k is maximized, i.e., k = the maximal number of repeating blocks at the end of the sequence so far. Then a(n+1) = max(k,4).
%C Here xy^k means the concatenation of the words x and k copies of y.
%C The first '6' occurs at a(3908). - _Sergio Pimentel_, Jul 13 2015
%H Giovanni Resta, <a href="/A091844/b091844.txt">Table of n, a(n) for n = 1..10000</a>
%H F. J. van de Bult, D. C. Gijswijt, J. P. Linderman, N. J. A. Sloane and Allan Wilks, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL10/Sloane/sloane55.html">A Slow-Growing Sequence Defined by an Unusual Recurrence</a>, J. Integer Sequences, Vol. 10 (2007), #07.1.2.
%H F. J. van de Bult, D. C. Gijswijt, J. P. Linderman, N. J. A. Sloane and Allan Wilks, A Slow-Growing Sequence Defined by an Unusual Recurrence [<a href="http://neilsloane.com/doc/gijs.pdf">pdf</a>, <a href="http://neilsloane.com/doc/gijs.ps">ps</a>].
%H <a href="/index/Ge#Gijswijt">Index entries for sequences related to Gijswijt's sequence</a>
%t maxBlockLength = 100; a[1] = 4; a[n_] := a[n] = Module[{rev = Reverse[Array[a, n - 1]]}, blockCount[blockLength_] := Module[{par, p1, k}, par = Partition[rev, blockLength]; If[par == {}, Return[1]]; p1 = First[par]; k = 1; While[k <= Length[par], If[par[[k]] != p1, Break[], k++]]; k - 1]; Max[Max[Array[blockCount, maxBlockLength]], 4]]; Array[a, 100] (* _Michael De Vlieger_, Jul 13 2015, after _Jean-François Alcover_ at A091799 *)
%o (PARI) {A091844(Nmax, L=1, A=List(), f(A,m=3,L=0)=while( #A>=(m+1)*L++, while( A[#A-L*m+1..#A]==A[#A-L*(m+1)+1..#A-L], (m+++1)*L>#A&& break)); m,t) = while(#A<Nmax, for(j=1,4, L=4*L+1; listput(A,4)); while(3 < t=f(Vec(A)), listput(A,t); L++)); Vec(A)} \\ The variable L, not needed here, yields the position of corresponding terms in sequence A091799. - _M. F. Hasler_, Sep 30 2018
%Y Cf. A090822, A091787, A091799, A091845.
%K nonn
%O 1,1
%A _N. J. A. Sloane_, Mar 10 2004
|