There exist several characterizations of k-regular sequences, all of which are equivalent. Some common characterizations are as follows. For each, we take R′ to be a commutative Noetherian ring and we take R to be a ring containing R′.
Let k ≥ 2. The k-kernel of the sequence s ( n ) n ≥ 0 {\displaystyle s(n)_{n\geq 0}} is the set of subsequences
The sequence s ( n ) n ≥ 0 {\displaystyle s(n)_{n\geq 0}} is (R′, k)-regular (often shortened to just "k-regular") if the R ′ {\displaystyle R'} -module generated by Kk(s) is a finitely-generated R′-module.1
In the special case when R ′ = R = Q {\displaystyle R'=R=\mathbb {Q} } , the sequence s ( n ) n ≥ 0 {\displaystyle s(n)_{n\geq 0}} is k {\displaystyle k} -regular if K k ( s ) {\displaystyle K_{k}(s)} is contained in a finite-dimensional vector space over Q {\displaystyle \mathbb {Q} } .
A sequence s(n) is k-regular if there exists an integer E such that, for all ej > E and 0 ≤ rj ≤ kej − 1, every subsequence of s of the form s(kejn + rj) is expressible as an R′-linear combination ∑ i c i j s ( k f i j n + b i j ) {\displaystyle \sum _{i}c_{ij}s(k^{f_{ij}}n+b_{ij})} , where cij is an integer, fij ≤ E, and 0 ≤ bij ≤ kfij − 1.2
Alternatively, a sequence s(n) is k-regular if there exist an integer r and subsequences s1(n), ..., sr(n) such that, for all 1 ≤ i ≤ r and 0 ≤ a ≤ k − 1, every sequence si(kn + a) in the k-kernel Kk(s) is an R′-linear combination of the subsequences si(n).3
Let x0, ..., xk − 1 be a set of k non-commuting variables and let τ be a map sending some natural number n to the string xa0 ... xae − 1, where the base-k representation of x is the string ae − 1...a0. Then a sequence s(n) is k-regular if and only if the formal series ∑ n ≥ 0 s ( n ) τ ( n ) {\displaystyle \sum _{n\geq 0}s(n)\tau (n)} is Z {\displaystyle \mathbb {Z} } -rational.4
The formal series definition of a k-regular sequence leads to an automaton characterization similar to Schützenberger's matrix machine.56
The notion of k-regular sequences was first investigated in a pair of papers by Allouche and Shallit.7 Prior to this, Berstel and Reutenauer studied the theory of rational series, which is closely related to k-regular sequences.8
Let s ( n ) = ν 2 ( n + 1 ) {\displaystyle s(n)=\nu _{2}(n+1)} be the 2 {\displaystyle 2} -adic valuation of n + 1 {\displaystyle n+1} . The ruler sequence s ( n ) n ≥ 0 = 0 , 1 , 0 , 2 , 0 , 1 , 0 , 3 , … {\displaystyle s(n)_{n\geq 0}=0,1,0,2,0,1,0,3,\dots } (OEIS: A007814) is 2 {\displaystyle 2} -regular, and the 2 {\displaystyle 2} -kernel
is contained in the two-dimensional vector space generated by s ( n ) n ≥ 0 {\displaystyle s(n)_{n\geq 0}} and the constant sequence 1 , 1 , 1 , … {\displaystyle 1,1,1,\dots } . These basis elements lead to the recurrence relations
which, along with the initial conditions s ( 0 ) = 0 {\displaystyle s(0)=0} and s ( 1 ) = 1 {\displaystyle s(1)=1} , uniquely determine the sequence.9
The Thue–Morse sequence t(n) (OEIS: A010060) is the fixed point of the morphism 0 → 01, 1 → 10. It is known that the Thue–Morse sequence is 2-automatic. Thus, it is also 2-regular, and its 2-kernel
consists of the subsequences t ( n ) n ≥ 0 {\displaystyle t(n)_{n\geq 0}} and t ( 2 n + 1 ) n ≥ 0 {\displaystyle t(2n+1)_{n\geq 0}} .
The sequence of Cantor numbers c(n) (OEIS: A005823) consists of numbers whose ternary expansions contain no 1s. It is straightforward to show that
and therefore the sequence of Cantor numbers is 2-regular. Similarly the Stanley sequence
of numbers whose ternary expansions contain no 2s is also 2-regular.10
A somewhat interesting application of the notion of k-regularity to the broader study of algorithms is found in the analysis of the merge sort algorithm. Given a list of n values, the number of comparisons made by the merge sort algorithm are the sorting numbers, governed by the recurrence relation
As a result, the sequence defined by the recurrence relation for merge sort, T(n), constitutes a 2-regular sequence.11
If f ( x ) {\displaystyle f(x)} is an integer-valued polynomial, then f ( n ) n ≥ 0 {\displaystyle f(n)_{n\geq 0}} is k-regular for every k ≥ 2 {\displaystyle k\geq 2} .
The Glaisher–Gould sequence is 2-regular. The Stern–Brocot sequence is 2-regular.
Allouche and Shallit give a number of additional examples of k-regular sequences in their papers.12
k-regular sequences exhibit a number of interesting properties.
Given a candidate sequence s = s ( n ) n ≥ 0 {\displaystyle s=s(n)_{n\geq 0}} that is not known to be k-regular, k-regularity can typically be proved directly from the definition by calculating elements of the kernel of s {\displaystyle s} and proving that all elements of the form ( s ( k r n + e ) ) n ≥ 0 {\displaystyle (s(k^{r}n+e))_{n\geq 0}} with r {\displaystyle r} sufficiently large and 0 ≤ e < 2 r {\displaystyle 0\leq e<2^{r}} can be written as linear combinations of kernel elements with smaller exponents in the place of r {\displaystyle r} . This is usually computationally straightforward.
On the other hand, disproving k-regularity of the candidate sequence s {\displaystyle s} usually requires one to produce a Z {\displaystyle \mathbb {Z} } -linearly independent subset in the kernel of s {\displaystyle s} , which is typically trickier. Here is one example of such a proof.
Let e 0 ( n ) {\displaystyle e_{0}(n)} denote the number of 0 {\displaystyle 0} 's in the binary expansion of n {\displaystyle n} . Let e 1 ( n ) {\displaystyle e_{1}(n)} denote the number of 1 {\displaystyle 1} 's in the binary expansion of n {\displaystyle n} . The sequence f ( n ) := e 0 ( n ) − e 1 ( n ) {\displaystyle f(n):=e_{0}(n)-e_{1}(n)} can be shown to be 2-regular. The sequence g = g ( n ) := | f ( n ) | {\displaystyle g=g(n):=|f(n)|} is, however, not 2-regular, by the following argument. Suppose ( g ( n ) ) n ≥ 0 {\displaystyle (g(n))_{n\geq 0}} is 2-regular. We claim that the elements g ( 2 k n ) {\displaystyle g(2^{k}n)} for n ≥ 1 {\displaystyle n\geq 1} and k ≥ 0 {\displaystyle k\geq 0} of the 2-kernel of g {\displaystyle g} are linearly independent over Z {\displaystyle \mathbb {Z} } . The function n ↦ e 0 ( n ) − e 1 ( n ) {\displaystyle n\mapsto e_{0}(n)-e_{1}(n)} is surjective onto the integers, so let x m {\displaystyle x_{m}} be the least integer such that e 0 ( x m ) − e 1 ( x m ) = m {\displaystyle e_{0}(x_{m})-e_{1}(x_{m})=m} . By 2-regularity of ( g ( n ) ) n ≥ 0 {\displaystyle (g(n))_{n\geq 0}} , there exist b ≥ 0 {\displaystyle b\geq 0} and constants c i {\displaystyle c_{i}} such that for each n ≥ 0 {\displaystyle n\geq 0} ,
Let a {\displaystyle a} be the least value for which c a ≠ 0 {\displaystyle c_{a}\neq 0} . Then for every n ≥ 0 {\displaystyle n\geq 0} ,
Evaluating this expression at n = x m {\displaystyle n=x_{m}} , where m = 0 , − 1 , 1 , 2 , − 2 {\displaystyle m=0,-1,1,2,-2} and so on in succession, we obtain, on the left-hand side
and on the right-hand side,
It follows that for every integer m {\displaystyle m} ,
But for m ≥ − a − 1 {\displaystyle m\geq -a-1} , the right-hand side of the equation is monotone because it is of the form A m + B {\displaystyle Am+B} for some constants A , B {\displaystyle A,B} , whereas the left-hand side is not, as can be checked by successively plugging in m = − a − 1 {\displaystyle m=-a-1} , m = − a {\displaystyle m=-a} , and m = − a + 1 {\displaystyle m=-a+1} . Therefore, ( g ( n ) ) n ≥ 0 {\displaystyle (g(n))_{n\geq 0}} is not 2-regular.25
Allouche and Shallit (1992), Definition 2.1. ↩
Allouche & Shallit (1992), Theorem 2.2. ↩
Allouche & Shallit (1992), Theorem 4.3. ↩
Allouche & Shallit (1992), Theorem 4.4. ↩
Schützenberger, M.-P. (1961), "On the definition of a family of automata", Information and Control, 4 (2–3): 245–270, doi:10.1016/S0019-9958(61)80020-X. /wiki/Doi_(identifier) ↩
Allouche & Shallit (1992, 2003). ↩
Berstel, Jean; Reutenauer, Christophe (1988). Rational Series and Their Languages. EATCS Monographs on Theoretical Computer Science. Vol. 12. Springer-Verlag. ISBN 978-3-642-73237-9. 978-3-642-73237-9 ↩
Allouche & Shallit (1992), Example 8. ↩
Allouche & Shallit (1992), Examples 3 and 26. ↩
Allouche & Shallit (1992), Example 28. ↩
Allouche & Shallit (1992), Theorem 2.3. ↩
Allouche & Shallit (2003) p. 441. ↩
Allouche & Shallit (1992), Theorem 2.5. ↩
Allouche & Shallit (1992), Theorem 3.1. ↩
Allouche & Shallit (2003) p. 445. ↩
Allouche and Shallit (2003) p. 446. ↩
Allouche and Shallit (2003) p. 441. ↩
Bell, J. (2006). "A generalization of Cobham's theorem for regular sequences". Séminaire Lotharingien de Combinatoire. 54A. ↩
Cobham, A. (1969). "On the base-dependence of sets of numbers recognizable by finite automata". Math. Systems Theory. 3 (2): 186–192. doi:10.1007/BF01746527. S2CID 19792434. /wiki/Doi_(identifier) ↩
Allouche & Shallit (1992) Theorem 2.10. ↩
Allouche and Shallit (2003) p. 444. ↩
Allouche and Shallit (1993) p. 168–169. ↩