*** Welcome to piglix ***

Complexity function


In computer science, the complexity function of a string, a finite or infinite sequence of letters from some alphabet, is the function that counts the number of distinct factors (substrings of consecutive symbols) from that string. More generally, the complexity function of a language, a set of finite words over an alphabet, counts the number of distinct words of given length.

Let u be a (possibly infinite) sequence of symbols from an alphabet. Define the function pu(n) of a positive integer n to be the number of different factors (consecutive substrings) of length n from the string u.

For a string u of length at least n over an alphabet of size k we clearly have

the bounds being achieved by the constant word and a disjunctive word, for example, the Champernowne word respectively. For infinite words u, we have pu(n) bounded if u is ultimately periodic (a finite, possibly empty, sequence followed by a finite cycle). Conversely, if pu(n) ≤ n for some n, then u is ultimately periodic.

An aperiodic sequence is one which is not ultimately periodic. An aperiodic sequence has strictly increasing complexity function (this is the Morse–Hedlund theorem), so p(n) is at least n+1.

A set S of finite binary words is balanced if for each n the subset Sn of words of length n has the property that the Hamming weight of the words in Sn takes at most two distinct values. A balanced sequence is one for which the set of factors is balanced. A balanced sequence has complexity function at most n+1.

A Sturmian word over a binary alphabet is one with complexity function n + 1. A sequence is Sturmian if and only if it is balanced and aperiodic. An example is the Fibonacci word. More generally, a Sturmian word over an alphabet of size k is one with complexity n+k−1. An Arnoux-Rauzy word over a ternary alphabet has complexity 2n + 1: an example is the Tribonacci word.

For recurrent words, those in which each factor appears infinitely often, the complexity function almost characterises the set of factors: if s is a recurrent word with the same complexity function as t are then s has the same set of factors as t or δt where δ denotes the letter doubling morphism aaa.


...
Wikipedia

...