OFFSET
2,13
COMMENTS
S is indexed from 1; that is, the first character of S has position 1.
Because S matches itself, a(1) = infinity.
This function (applied to any particular S) is called Z_n(S) in Gusfield and has implications for performing efficient string searching.
REFERENCES
Dan Gusfield, Algorithms on Strings, Trees, and Sequences, Cambridge Univ. Press, 1997 (see Section 1.3).
LINKS
Sean A. Irvine, Table of n, a(n) for n = 2..1000
PROG
(Python)
from os.path import commonprefix
M = 3000 # produces 10889 terms
an, n, alst = 0, 2, []
C = "".join(str(i) for i in range(1, M+1))
while n+an < len(C):
an, n = len(commonprefix([C[n-1:], C])), n+1
alst.append(an)
alst = alst[:-1]
# Michael S. Branicky, Jan 30 2026
CROSSREFS
KEYWORD
nonn
AUTHOR
Sean A. Irvine, Jan 29 2026
STATUS
approved
