login
A387487
a(n) is the length of the longest prefix of S matching the substring of S starting at n where S = 123456789101112... is the Champernowne word (A033307).
2
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
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
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