login
a(1) = 1; for n>1, a(n) = largest integer k such that the word a(1)a(2)...a(n-1) is of is of the form xy^(k_1)Y^(k_2)y^(k_3)Y^(k_4)...y^(k_(m-1))Y^(k_m) where y has positive length and Y=reverse(y) and k_1+k_2+k_3+...+k_m = k.
8

%I #15 Nov 05 2023 14:36:28

%S 1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,2,1,1,2,2,2,3,2,2,2,3,2,2,2,3,3,

%T 2,2,2,4,1,1,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,2,1,1,2,2,2,3,2,2,2,3,2,

%U 2,2,3,3,2,2,2,4,2,1,1,2,2,2,3,1,1,2,1,1,2,2,2,3,1,1,2,2,2,3,2,1,1,2,2,2,3

%N a(1) = 1; for n>1, a(n) = largest integer k such that the word a(1)a(2)...a(n-1) is of is of the form xy^(k_1)Y^(k_2)y^(k_3)Y^(k_4)...y^(k_(m-1))Y^(k_m) where y has positive length and Y=reverse(y) and k_1+k_2+k_3+...+k_m = k.

%C Here ^ denotes concatenation. This is similar to Gijswijt's sequence A090822 except that the 'y' block still counts when reversed. Thus 2 1 1 2 counts as the 2 blocks (21)(12)

%H Michael S. Branicky, <a href="/A091975/b091975.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="http://www.cs.uwaterloo.ca/journals/JIS/index.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>

%o (Python)

%o def k(s):

%o maxk = 1

%o for m in range(1, len(s)+1):

%o i, y, kk = 1, s[-m:], len(s)//m

%o if kk <= maxk: return maxk

%o yY = [y, y[::-1]]

%o while s[-(i+1)*m:-i*m] in yY: i += 1

%o maxk = max(maxk, i)

%o def aupton(terms):

%o alst = [1]

%o for n in range(2, terms+1):

%o alst.append(k(alst))

%o return alst

%o print(aupton(105)) # _Michael S. Branicky_, Nov 05 2023

%Y Cf. A090822, A091976, A092331-A092335.

%K nonn

%O 1,3

%A J. Taylor (integersfan(AT)yahoo.com), Mar 15 2004