Divide-and-conquer 2-rational sequences

Philippe Dumas's home page
Divide-and-conquer | Maple
Publications | Address | Version française

Among the Mahlerian sequences, we distinguish a particular class, namely the class of sequences that are rational with respect to the radix 2 or, for brevity, 2-rational sequences. One defines a 2-rational sequence (un) by a linear representation. Such a representation consists of a row matrix , a column matrix and two square matrices A0 and A1 whose sizes are respectively , and for a certain integer N. If an integer has as binary expansion

the value of the sequence for this integer n is

The concept of a 2-rational sequence or more generally a B-rational sequence (the definition is easy to write up) is a direct extension of the concept of a rational sequence, i.e. of sequence whose generating series is a rational function (not admitting 0 as a pole). This concept appears in [4] where one speaks about 2-regular sequence, but this terminology appears to be too fuzzy, the word regular having multiple meanings. One finds in [4] many examples of 2-rational sequences. The simplest one is certainly the sequence which gives the number of 1s in the binary writing of n. This sequence admits the linear representation

Characterization of the sequences which are rational with respect to the radix 2. We defined a 2-rational sequence by a linear representation; in real life examples are not given in this way and one must thus prove the 2-rationality. Often a divide-and-conquer recurrence is given and one can then apply the following result [12]. If the formal series f(z) satisfies the equation

in which a is an integer and b(z) is a 2-rational series, then f(z) is 2-rational. For sequences, recurrences of the form

provide 2-rational sequences if (bn) is 2-rational. One notes that in this recurrence the only term wich depends directly on n, fn-a, is determined by the terms which depend on n/ 2, n/ 4, etc. It is convenient to give a result a little more general because one frequently encounters recurrences defined according to the residue modulo a power of 2. For example in [35] the study of an algorithm of Euclidean matching leads to consider a sequence (cn) which satisfies

The generating series f00(z), f01(z), f10(z), f11(z) respectively associated with the sequences (c4n), (c4n+1), (c4n+2), (c4n+3) and the vector of formal series

satisfy the equation

with

One can show that a vector of formal series F(z) satisfying an equation of the form

in which a is an integer, Ck(z) are square matrices whose entries are polynomials, and B(z) is a vector of 2-rational formal series, has 2-rational components. Again it should be noticed that the associated sequences satisfy a recurrence which provides the term of index n from the terms of index n/ 2, n/ 4, etc. One concludes thus that the sequence (cn) is 2-rational.

In the same way the sequence defined by [21, p. 25]

which appears in an algorithm on permutations, satisfies

it is thus 2-rational. In fact it may be expressed by the formula

where is again the number of 1s in the binary expansion of an integer k.

Linear representation. Knowing that a sequence is 2-rational, it is natural to look for a linear representation of it. The 2-regularity of a sequence (un) expresses the fact that the sequences (un), (u2n), (u2n+1), (u4n), (u4n+1), (u4n+2), (u4n+3), etc, all live in a space of finite dimension. To emphasize this point one associates with the sequence a binary tree. Its root is labelled by the sequence (un) itself, and more generally the nodes are labelled by the subsequences (u2kn+r), with . The childrens of the node labelled with (u2kn+r) are labelled by (u2k+1n+r) and (u2k+1n+2k+r). Moreover sequences which label the internal nodes of the tree are linearly independent and the sequences which label the leaves of the tree may be expressed as linear combinations of the previous ones.

Applying this algorithm one obtains for the sequence (Tn) which gives the cost of mergesort in the worst case the following tree and relations of recurrences.

These relations of recurrence may be translated into a linear representation of dimension N= 5.

Indeed 2-rational series are the translation via the positional binary notation of the rational series on the alphabet of formal language theory [7]; with the 2-rational series

with support in the rational language of binary expansions . A consequence is that for a 2-rational series f(z) the so called condensate series

is a rational series in the ordinary meaning.

2-automatic sequences. Another demonstration of the link with the theory of formal languages is the concept of a 2-automatic sequence, which predates the concept of a 2-rational sequence [8]. 2-automatic sequences are 2-rational sequences which take only a finite number of values. An example will make clear which kind of automaton is under consideration. The sequence of paper folding is defined as follows [10]. One folds a paper tape an infinite number of times and always in the same direction. Then one unfolds the tape and one observes the folds. They can be entering or outgoing and by suitably coding these folds by 0 or 1, one obtains a sequence which starts with 1101100. This sequence is 2-rational because it satisfies the recurrence

This recurrence immediately gives the 2-automaton of paper folding, represented below.

One computes the value of the sequence on a given integer by using the 2-automaton. One starts from the initial state i indicated by an entering arrow and one follows the arrows according to the bits of the integer, starting with the least significant bit; one then looks at the value associated with the final state; it is the sought value. If one search for the value of the sequence for the integer thirteen, whose binary expansion is 1101, one successively goes through states i, i, a, c, and c while following the arrows labelled 1, 0, 1 and eventually 1. The output function gives the value 0. One will find in [1] a presentation of the various problems involved in automatic sequences.

 Previous page: Complexity and recurrences Next page: Asymptotic behavior