A general upper bound in extremal theory of sequences

We investigate the extremal function f(u, n) which, for a given finite sequence u over k symbols, is defined as the maximum length m of a sequence v = a1a2...am of integers such that 1) 1 ≤ ai ≤ n, 2) ai = aj , i 6= j implies |i − j| ≥ k and 3) v contains no subsequence of the type u. We prove that f(u, n) is very near to be linear in n for any fixed u of length greater than 4, namely that f(u, n) = O(n2 |u|−4)). Here |u| is the length of u and α(n) is the inverse to the Ackermann function and goes to infinity very slowly. This result extends the estimates in [S] and [ASS] which treat the case u = abababa . . . and is achieved by similar methods.