<<

DISCRETE AND CONTINUOUS Website: http://aimSciences.org DYNAMICAL SYSTEMS Volume 15, 1, May 2006 pp. 281–352

EUCLIDEAN DYNAMICS

Brigitte Vallee´ GREYC, UMR CNRS 6072, University of Caen Batiment Sciences 3, Campus II F-14032 Caen, France

Abstract. We study a general class of Euclidean algorithms which compute the greatest common [gcd], and we perform probabilistic analyses of their main parameters. We view an algorithm as a dynamical system restricted to rational inputs, and combine tools imported from dynamics, such as trans- fer operators, with various tools of analytic combinatorics: generating func- tions, Dirichlet series, Tauberian theorems, Perron’s formula and quasi-powers theorems. Such dynamical analyses can be used to perform the average-case analysis of algorithms, but also (dynamical) analysis in distribution.

1. Introduction. Computing the [Gcd] –on or – is a central problem in computer algebra, and all the gcd algorithms are based on main principles due to Euclid. See for instance [113] or [110] for a de- scription of use of Gcd Algorithms in Computer Algebra. According to Knuth [56], “we might call Euclid’s method the granddaddy of all algorithms, because it is the oldest nontrivial algorithm that has survived to the present day.” Indeed, Euclid’s algorithm is currently a basic building block of computer algebra systems and multi- precision libraries, and, in many such applications, most of the time is spent in computing gcd’s. However, the Euclidean algorithms have not yet been completely analyzed, and it is the purpose of this paper to provide such an analysis. 1.1. Various divisions. All the basic Gcd algorithms can be described as a se- quence of divisions, and the Gcd Algorithms mainly depend on what kind of is used. On polynomials, there exist two possible divisions: the first one is directed by leading monomials (i.e., monomials of highest degree) and deals with decreasing degrees. The second one is directed by monomials of lowest degree and deals with increasing valuations. In fact, the probabilistic behaviours of the two associated gcd algorithms are similar, since the execution of the first algorithm on the pair (u, v) coincides with the execution of the second algorithm on the mirror pair (u, v) formed with the mirrors u, v of u, v. On , there exist many different divisions: on a pair (u, v) of integers, a division performs a decomposition of the form v = m u + r, with a m and a r. Here, all the integers are written· in base 2, and we work with their Most Significant Bits (MSB’s) [i.e., the bits on the left of the binary expansion] or with their Least Significant Bits (LSB’s) [i.e., the bits on the

2000 Mathematics Subject Classification. Primary: 68Q25, 68W40, 37E05, 37C30, 11M41; Secondary : 47A. Key words and phrases. Analysis of algorithms, dynamical systems of the interval, transfer operators, Dirichlet series .

281 282 BRIGITTE VALLEE´ right of the binary expansion]. The choice of pair (m, r) can be directed by the MSB’s of the integers u, v or by their LSB’s; for instance, the usual division, which is directed by the MSB’s, aims to combine v with a multiple of u, of the form m u in order to create zeroes on the MSB’s [i.e., on the left]: then, the remainder· r has a smaller absolute value than u. On the contrary, the LSB division is directed by the Least Significant Bits: it aims to combine v with a multiple of u, of the form m′ u in order to create zeroes on the LSB’s [i.e., on the right]; then, the remainder· r has more zeroes on the right than u: the 2–adic absolute value of r is smaller than the 2–adic absolute value of u. Here, what we call a “direction” or a “decision” is related to the choice of the pair (m, r). However, after this choice, all the computations [multiplication of u by m, subtraction r := v m u are the usual ones, and are performed, as usual, from the right to the left. The− carry· propagates also from the right to the left. This explains that all these algorithms do not have the same behaviour, because of the carry propagation, which may play a different rˆole in these various divisions. In particular, the mirror property of polynomials is lost for integers. These integer divisions, and thus the Euclidean algorithms based on these divi- sions, can be gathered into four groups, or four types: The MSB Group [or Type 1] contains all the divisions which choose the quotient according to the MSB’s : it is the analogue, for the numbers, of the decreasing– degree algorithms for polynomials. It contains of course the (Standard) Euclid algorithm, but also its possible variants, according to the position of remainder r [Centered division, By-Excess division, α–division, as described in [19]], or the parity of quotient m [Odd division, Even division]. Finally the Subtractive Algorithm does not perform any divisions, only subtractions. [See Figure 1]. It is also interesting to consider divisions which choose the quotient according to the LSB’s. The LSB Group [or Type 4], is the integer analogue to increasing– valuation gcd algorithm for polynomials. Such a gcd algorithm is described in [98] for instance. In fact, there are two LSB divisions, the Plain LSB division and the Centered LSB division, according to the position of the quotient [non centered or centered]. There also exist two mixed groups which operate a sort of transition between these two extremal groups; the mixed divisions are directed by both MSB’s and LSB’s, in order to create zeroes both on the right and on the left. However, the dominant rˆole can be played by the MSB’s or LSB’s. For some divisions, the decision is mostly made by the MSB’s, and the LSB’s play only an auxilliary rˆole; these divisions form the MLSB Group [or Type 2] which contain the so–called pseudo–Euclidean Algorithms, introduced by Shallit [88] and Vall´ee [106], [107]. Roughly speaking, a pseudo–division is just a MSB division where powers of two are removed from the remainder, after the division: This means that the pair (m, r) is chosen according to the MSB’s, and, after this, there is a binary shift a on r directed by the LSB’s which creates an odd pseudo- remainder s which satisfies r := 2a s. Pseudo–divisions give rise to algorithms which only deal with odd numbers,· and they are well–adapted to computing the Jacobi symbol [52] [61], for instance [the Quadratic Reciprocity law being only true for a pair of odd integers]. For the Binary division of Stein [96] described in [56] and the Plus-Minus division, of Brent and Kung [15], the main decision is made by the LSB’s; the MSB’s play EUCLIDEAN DYNAMICS 283 only an auxilliary rˆole, and only decide when the exchange has to be done: these two algorithms form the LMSB Group [or Type 3] Finally, divisions form their own type, [Type 0], which contains the two divisions previously described.

1.2. A general framework for gcd algorithms. Any gcd algorithm performs a sequence of steps. Each step is formed with a division, (possible) binary shifts (uniquely for numbers), and (possible) sign changings. The total operation per- formed in each step is called a division step. Such a step is followed by an exchange. We will see in the following that the probabilistic behaviour of a gcd algorithm heav- ily depends on the division-step which will be used. For the moment, in this Section, we describe the general framework for all the gcd algorithms which are studied in this paper. For all types, each division–step can be written as u =2a u′, v = m u′ + ǫ 2b r′. · · · · It performs (before the next division) a first binary shift equal to some integer a 0 on divisor u, then the division itself, which produces a remainder shifted by a shift≥ equal to some integer b 0. Remark that the shift b is produced by the division itself. This remainder has≥ also a sign ǫ = 1. Here u,v,m,u′, r′ are integers1. The division uses a “digit” d = (m,ǫ,a,b), and± changes the old pair (u, v) into the new pair (r′,u′) and can be written as a matrix transformation u r′ 0 2a = M ,M := . (1.1) v [d] u′ [d] ǫ 2b m       For Types 0 and 1, there are no binary shifts to be used, and the two exponents a and b equal 0. For Type 2, the shift a is possibly not zero, while b equals 0. For Type 3, a equals 0, while the shift b is always non zero. Finally, for Type 4, the two exponents a and b are equal and non zero. Instead of “integer” pairs (u, v), (r′,u′), we consider “rationals” [the old rational x = u/v, and the new rational y = r′/u′], and we wish to describe the relation induced by the division on x, y: For each digit d = (m,ǫ,a,b), there exists a linear fractional transformation (LFT) h[d], associated to the matrix M[d] of Eqn (1.1) for which 2a x = h (y) with h (y)= . [d] [d] m + ǫ 2by Remark that the absolute value det h of the determinant of the LFT h is equal | [d]| [d] to 2a+b and thus involves the total number a + b of binary shifts that are used in the division-step. Any execution of a gcd algorithm can be described as follows. On the input pair (u, v) = (u1,u0), it will be of the form

−a1 b1 u1 := 2 u1, u0 = m1 u1 + ǫ1 2 u2, u := 2−a2 u , u = m u + ǫ 2b2 u ,  2 2 1 2 2 2 3   ..., ...  , (1.2)  −ai bi  ui := 2 ui, ui−1 = mi ui + ǫi 2 ui+1 ..., ...     1“integer” with quote has here a generic meaning; it denotes integer (numbers) or polynomials while “rationals” denote rational numbers or rational . 284 BRIGITTE VALLEE´ and uses the sequence of digits di := (mi,ǫi,ai,bi). It stops at the p–th iteration with up+1 = η up. Then gcd(u, v)= up. Very often, the final value η equals 0, but, in some cases, ·η may be equal to 1. On an input (u, v) whose gcd is d, the execution (1.2) creates a matrix product of the form u ηd ηd = M M . . . M = M with M := M , (1.3) v 1 · 2 · · p d d i [di]       and also a continued expansion (CFE) of the form u e0 = e = h1 h2 ...hp(η)= h(η). (1.4) v m + 1 ◦ ◦ 1 e2 m2 + . e .. + p−1 mp + ep η

Here, the LFT’s hi are defined as hi := h[di] and the numerators ei which appear in the CFE are defined as e := ǫ 2bi+ai+1 , with ǫ =1, b = a =0. (1.5) i i · 0 0 p+1 Remark that h in (1.4) is a LFT, and M in (1.3) is an integer matrix of the form αx + β α β h(x)= ,M = with α,β,γ,δ coprime integers. γx + δ γ δ   When the algorithm performs p iterations, it gives rise to a of depth p [the depth of a continued fraction equals its number of levels]. For each algorithm, we define a pair (u, v) to be valid if the rational u/v satisfies the same conditions as the ouput rational r′/u′ created by the division. We choose as the set of inputs of the algorithm, the set of valid pairs. In this way, the first step of the algorithm will resemble any other step of the algorithm. Quite often, each particular algorithm defines a precise subset of LFT’s which it uses at each iteration [except perhaps for the first and the finalH steps where it may use some slightly different sets and ]. See Figure 1 for examples of such a situation for the MSB Class [TypeJ 1]. Then,F Relation (1.4) [summarized by u/v = h(η)] defines a bijection between the set Ω of valid coprime inputs (u, v) of the algorithm and ⋆ ⋆ k the set of LFT’s where denotes the semi-group k≥0 . For AlgorithmsI ·of H Type·F 2, theH valid inputs are restricted to∪ beH odd. Since, for this type, the shift b is zero, there is a relation between parity of the quotient mi at step i and the exponent ai+1 at the beginning of the i + 1-th step: if mi is odd, then the remainder is even, and thus a satisfies a 1; if m is even, then the i+1 i+1 ≥ i remainder is odd, and thus ai+1 equals 0. We then consider two states: the 0–state, which means “the previous quotient of (v,u) is even” (or equivalently the previous remainder is odd), i.e., the present shift a equals 0; the 1–state, which means “the previous quotient of (v,u) is odd” (or equivalently the previous remainder is even), i.e., the present shift a satisfies a 1. Then, the processus is of a Markovian type, ≥ and it uses four different sets , where brings rationals from state i to state j. The initial state isH always the 0–stateH and the final state is always the 1–state. See Figure 14 for instances of such a situation. 1.3. Main parameters. The main parameters which describe the execution of the algorithm on the input (u, v), namely the digits and the continuants, can be read on the continued fraction of u/v. The mi’s are called the , the triples di = (mi,ǫi,ai,bi) are the digits. The continuants are defined when one “splits” EUCLIDEAN DYNAMICS 285

Alg., X. η Division Set of LFT’s Conditions on J or F. v = mu + r 1 (G) [0, 1], 0 G = { , m ≥ 1} F = G {m ≥ 2} 0 ≤ r < u m + x T v = mu − r 1 (M) [0, 1], 1 M = { , m ≥ 2} F = M {m ≥ 3} 0 ≤ r < u m − x T v = mu + ǫr 1 ǫ = ±1, K = { , ǫ = ±1, (K) [0, 1/2], 0 m + ǫx F = K {ǫ = 1} (m, ǫ) ≥ (2, +1) T u (m, ǫ) ≥ (2, +1)} 0 ≤ r < 2 v = mu + ǫr 1 (E) [0, 1], 1 m even, ǫ = ±1, E = { ,m even, ǫ = ±1} F = E {ǫ = 1} m + ǫx 0

Figure 1. The six Euclidean algorithms of the MSB Class. the CFE (1.4) of u/v at depth i, or when one splits the matrix product (1.3) at step i; one obtains two CFE’s defining a rational number [or two matrix products defining an integer vector]. The first one defines the beginning rational pi/qi, [with coprimes pi, qi]. The pair Qi := (pi, qi) is called the i-th beginning continuant. Pair (pi, qi) is defined, from (1.4) or (1.3), as p e i := 0 = h h . . . h (0), (1.6) e1 1 2 i qi m + ◦ ◦ ◦ 1 e2 m2 + e m + 3 3 . e .. + i−1 mi or, with the matrix point of view,

pi 0 Qi = = M1 M2 . . . Mi (1.7) qi · · · 1    

Rationals pi/qi are often called convergents, and they are useful for approximating the rational u/v. The beginning continuants are closely related to Bezout sequences that appear in the Extended Euclidean Algorithms which compute not only the gcd but also the Bezout coefficients. The second CFE defines the ending rational ti/vi with coprimes ti, vi, The i-th ending continuant is the pair Vi := (ti, vi). Pair (ti, vi) is defined, from (1.4) or (1.3), as

t 2ai+1 i := = h h . . . h (η). (1.8) v ei+1 i+1 ◦ 2 ◦ ◦ p i mi+1 + e m + i+2 i+2 ei+3 mi+3 + . e .. p−1 + b mp + ǫp2 p f 286 BRIGITTE VALLEE´ or, with the matrix point of view,

ti η Vi = = Mi+1 Mi+2 . . . Mp (1.9) vi · · · 1     The ending continuants are closely related to the remainder pairs Ui := (ui+1,ui) that appear in the execution (1.2) of the Euclidean algorithms on input (u, v), via the relation Ui = gcd(u, v) Vi.

1.4. Probabilistic analyses. Here, we are interested in the probabilistic be- haviour of each algorithm: it is mainly described by the probabilistic behaviour of digits and continuants, which play here the rˆole of observables. As it is usual in complexity studies, we consider the set formed of the valid inputs (u, v) of a gcd algorithm and we first define both an absolute value and a size on it. In fact, we consider two sets Ω and Ω: the second is formed with all the valid inputs of the algorithm [the notion of valid inputs is defined in Section 1.2], while the first one only contains the coprimee valid inputs. We mainly deal with the set Ω. It may seem strange –at least from an algorithmic point of view– to study sets of inputs for which the answer of the algorithm is trivial! However, we shall prove that this (trivial) set is in a sense generic, and it will be easy to transfer the results on Ω to the (more natural) set Ω [see Section 1.6 for a first explanation of this fact]. We first define the absolute value of an “integer” u. In the polynomial case deg u [Type 0], the absolute value ofe a non zero polynomial u of Fq[Z] is u := q , while its size ℓ(u) is ℓ(u):= 1+deg u. In the integer case [all the other| | types], the absolute value is the usual (archimedean) one, and the size of a (non-zero) integer u is its binary length, equal to ℓ(u):=1+ log2 u . In both cases, the size ℓ(u) is Θ(log u ). ⌊ | |⌋ We| wish| to define the absolute value of a pair (u, v) as a of the absolute values of u and v. There are two main cases, according to the type [Type 4, or all the other types]. Case (a). For all the algorithms [except Type 4], the absolute value of remainder r′ is less than the absolute value of u′. This means that any valid input (u, v) satisfies u v , and it is adequate to choose as the absolute value of the input pair (u, v|) the| ≤ maximum | | of the absolute values u and v , which equals v . Finally, the absolute value (u, v) of the pair (u, v) and| its| size| L| (u, v) are | | | | (u, v) := max( u , v )= v ,L(u, v) := ℓ( (u, v) )= ℓ( v ), (1.10) | | | | | | | | | | | | Moreover, using the equality u/v = h(η) —where η is the final rational value of the algorithm, and h is the LFT built by the algorithm [see (1.4)] — entails the important relation, valid for any coprime input pair (u, v), (u, v) = v = D[h](η), where η is the final value of the algorithm, (1.11) | | | | which involves the denominator function D[h] of the LFT h, defined by αx + β D[h](x) := γx+δ , for h(x) := with α,β,γ,δ coprime integers. | | γx + δ

Case (b). For the LSB Group [Type 4], it is no longer true that the absolute value of remainder r′ is less than the absolute value of u′. The set of rationals u/v related to valid inputs (u, v) is no longer a subset of a compact interval of R. Then, it is convenient to deal with the Euclidean norm and to choose as the absolute value EUCLIDEAN DYNAMICS 287

(u, v) of the input pair (u, v) the Euclidean norm (u2 + v2)1/2. Then, the absolute value| |(u, v) of the pair (u, v) and its size L(u, v) are | | 1 (u, v) := (u2 + v2)1/2,L(u, v) := ℓ( (u, v) )= ℓ(u2 + v2). (1.12) | | | | 2 Moreover, for any coprime input pair (u, v), the final pair of the LSB algorithm is (0, 1), and using the equality (u, v)= M(0, 1) entails the relation (u2 + v2)= (u, v) 2 = M(0, 1) 2, (1.13) || || || || where M is the matrix built by the algorithm [see (1.3)]. Finally, for all types, the sets

Ω := (u, v) Ω; L(u, v)= N , Ω := (u, v) Ω; L(u, v)= N (1.14) N { ∈ } N ∈ n o gathers valid inputs of size N and are endowede with uniforme probabilities denoted by PN , PN . We denote by EN , EN the associate expectations.

1.5. Maine parameters. We wishe to analyze the probabilistic behavior of the main observables (as digits or continuants) on the set ΩN , when the size N of the input (u, v) becomes large. We then (easily) come back to ΩN . Sometimes, for distribu- tional analysis, we work on the set

+ + e ΩN := ΩM , ΩN := ΩM . M[≤N M[≤N The complexity analysis of each algorithm firste aims toe study the number of iter- ations that are performed during the execution (1.2). More generally, we wish to study three kinds of parameters: digit-costs, continuants and bit–complexity. Digit-costs. These are general additive parameters which (only) depend on the sequence of the digits di = (mi,ǫi,ai,bi). More precisely, we consider the set of the possible digits, and we define a cost c(d) relative to each digit d. Since the LFTD h[d] only depends on digit d, this cost can also be defined on , via c(h) := c(d) ∗ H for h = h[d]. We can extend this cost to the semi-group in an additive way, and deal with “additive” costs where the total cost is the sumH of elementary costs of each step. We then attach to the execution (1.2) of the gcd algorithm on the input (u, v) the total cost C(u, v) defined by p u C(u, v) := c(d )= c(h) if = h(η). (1.15) i v i=1 X We consider a large class of digit-costs c, and in particular the so–called costs of moderate growth where digit-cost c is O(ℓ) where ℓ is the size [of a digit]. This class contains in particular some particular parameters which are are of great algorithmic interest. For instance, if c = 1, then C is the number of iterations. If c is the characteristic function of some particular quotient m0, then C is the number of occurrences of this particular quotient during the execution of the algorithm. If c is the size ℓ(d) of the digit d, then C is the length of the binary encoding of the continued fraction.

Continuants. Second, we wish to describe the evolution of the size L(Qi), L(Vi) of the beginning or ending continuants, together with the size L(Ui) of the remainder pairs Ui. These parameters are central in the study of the extended gcd algorithms, and also in the so–called interrupted gcd algorithms which stop as soon as the size 288 BRIGITTE VALLEE´

L(Ui) of the i-th remainder becomes smaller than a given proportion of the input size L(U0). Bit-complexities. Third, the bit–complexity is the most possible precise complexity measure of a gcd–algorithm; It is is defined as the sum of the binary costs of each division-step, and the binary cost of a division of the form v = mu + ǫr is equal to ℓ(m) ℓ(u). Then, the bit-complexity B of a gcd algorithm, is defined as · p B(u, v) := ℓ(d ) L(U ), i · i i=1 X and involves parameters of both types. This is the same situation for the bit– complexity of the extended gcd algorithm

p B(u, v) := B(u, v)+ B(u, v) with B(u, v) := ℓ(d ) L(Q ), i · i i=1 X b which involves all the various kinds of parameters. Remark that such costs, even if they are written as a sum of elementary costs, are no longer additive, since [for instance] the term ℓ(di) L(Qi) involves the i-th continuant Qi which depends on all the previous steps. · We wish to provide probabilistic analyses for all these parameters: the first study aims to exhibit their average–case behaviour [expectation, and more generally, moments of higher order], while the second study, much more precise, aims to describe their asymptotic distribution, when the size N of the inputs becomes large.

1.6. The main steps of a “dynamical analysis”. Until 95, the methods em- ployed in Euclidean Analysis are rather disparate, and their applicability to new situations is somewhat unclear. See Section 9 for an historical account. Then, during the last ten years, the Caen Group designed a unifying framework for the analysis of Euclidean Algorithms that additionally provided new results, for the average–case analysis as well for distributional analysis. All the analyses which will be described here are instances of this methodology, the so–called dynamical analysis, where one proceeds in three main steps: First, the (discrete) algorithm is extended into a continuous process, which can be defined in terms of a dynami- cal system, where executions of the gcd algorithm are then described by particular trajectories [i.e., trajectories of “rational” points]. Second, the main parameters of the algorithm are extended and studied in this continuous framework: the study of particular trajectories is replaced by the study of generic trajectories. Finally, one operates a transfer “from continuous to discrete”, and proves that the probabilistic behaviour of gcd algorithms [related to “rational” trajectories] is quite similar to the behaviour of their continuous counterparts [related to generic trajectories].

1.7. The Dirichlet moment generating functions. Our main tool is, as it is generally the case in analysis of algorithms, generating functions. The crucial rˆole of generating functions in the analysis of data structures and algorithms is well described in books by Flajolet and Sedgewick [33, 34]. EUCLIDEAN DYNAMICS 289

We consider a general parameter R defined on Ω, Ω, and we wish to study its dis- tribution on ΩN , when endowed with the uniform probability. Our final probabilis- tic tool [for distributional analyses] is the sequence ofe moment generating functions EN [exp(wR)],

Φw(N) EN [exp(wR)] = , with Φw(N) := exp[wR(u, v)]. (1.16) Φ0(N) (u,vX)∈ΩN If we restrict ourselves to average-case analysis, we aim studying all the moments of order k, namely 1 ∂k 1 E k k N [R ]= k Φw(N) w=0 = R (u, v). Φ0(N) · ∂w | Φ0(N) · (u,vX)∈ΩN We first consider the whole set Ω of inputs and our strategy consists in encapsulat- ing all the moment generating functions EN [exp(wR)] in a unique Dirichlet series SR(s, w), 1 S (s, w) := exp[wR(u, v)], (1.17) R (u, v) 2s (u,vX)∈Ω | | which deals with the absolute values of inputs (u, v) defined in (1.10) or in (1.12) according to the type [Type 4, or not]. Remark that our main object of interest, the moment generating functions EN [exp(wR)] can be easily recovered with coefficients of series SR(s, w): if φw(n) denotes the cumulative value of cost exp[wR] on pairs (u, v) whose absolute value equals n,

φw(n) := exp[wR(u, v)], (u,v);X|(u,v)|=n then the series SR(s, w) is of the form φ (n) S (s, w) := w , with φ (n)=Φ (N). (1.18) R n2s w w nX≥1 n;ℓX(n)=N [Here, ℓ is the size [defined in Section 1.4] and Φw(N) is defined in (1.16)]. Then, Equations (1.16) and (1.18) show that the moment generating function EN [exp(wR)] is a ratio, where numerators and denominators are sums of coeffi- cients of the Dirichlet series SR(s, w). The series SR(s, w) is a generating function, of Dirichlet type with respect to the variable s. It is important to notice that, in the polynomial case, it is also a power −2s series with respect to z = q , denoted by TR(z, w),

deg v TR(z, w) := z exp[wR(u, v)]. (1.19) (u,vX)∈Ω Parameters s or z “mark” the size, while the parameter w “marks” the cost R. We can adopt the same strategy for each moment of order k, and we obtain [k] a Dirichlet Series SR (s) with respect to the unique variable s, which is the k-th derivative of w S (s, w) at w = 0, 7→ R ∂k 1 S[k](s) := S (s, w) = Rk(u, v). (1.20) R ∂wk R |w=0 (u, v) 2s (u,vX)∈Ω | | 290 BRIGITTE VALLEE´

As previously, these series are of Dirichlet type with respect to the variable s; moreover, they are power series with respect to z = q−2s in the polynomial case, [k] deg v k TR (z) := z R (u, v). (1.21) (u,vX)∈Ω k And, in the same vein as above, the moment EN [R ] of order k can be easily [k] [k] recovered with coefficients of series SR (s): if φ (n) denotes the cumulative value of cost Rk relative to pairs (u, v) whose absolute value equals n, φ[k](n) := Rk(u, v), (u,v);X|(u,v)|=n [k] then the series SR (s) is of the form φ[k](n) Φ[k](N) S[k](s) := , with E [Rk]= , Φ[k](N) := φ[k](n). R n2s N Φ[0](N) nX≥1 n;ℓX(n)=N k Then, the previous equations show that each moment EN [R ] of order k is a ratio, where numerators and denominators are sums of coefficients of the Dirichlet series [k] SR (s). We look for alternative expressions for the bivariate generating functions SR(s, w). [Note that these expressions can be easily transfered to the univariate [k] generating functions SR (s)]. From these alternative expressions, the position and the nature of the (dominant) singularity of SR(s, w) become apparent. These in- formations will be transfered to informations about the asymptotics of coefficients, and provide distributional analyses [if we can work with the bivariate generating functions SR(s, w)] or only average-case analysis [if it is only possible to deal with [k] univariate functions SR (s)]. Since the natural set of inputs is the set Ω defined in (1.14), it would be convenient [k] to directly deal with the tilde series SR(s, w) and SR (s) relative to set Ω, and deal with the tilded objects in the same way ase with the untilded objects. However, it is easier to work with untilded versions,e and, for thee particular costs toe be studied [additive costs C associated to digit costs c, or continuant lengths], there exists a simple relation between SR(s, w) and its tilde version. In the case when R = C or R = log( Q ), log( V ), one has R(du, dv)= R(u, v), which entails the equality | i| | i| S (s, w)= ζ(2s) S (s, w) (1.22) R · R where ζ(s) is the Zeta series of possible gcd’s. In the case when R = log(Ui), the relation R(du, dv) = log d + Re (u, v) entails the equality S (s, w)= ζ(2s 2w) S (s, w). (1.23) R − · R Taking the derivatives with respect to w in (1.22) or in (1.23) provides relations [k] e between the series SR (s) and its tilde version. With well–known properties of the zeta function, it will be easy to transfer properties of the untilded generating functions to tilded generating functions. This is why it will be sufficient to study coprime inputs, as we already said in Section 1.4. Plan of the paper. The plan of the paper will follow the main steps of Dynam- ical Analysis, as described in Section 1.5. Section 2 describes the main notions on dynamical systems which will be used here, namely random dynamical sys- tems, transfer operators, induction method, etc. . . Section 3 builds the dynamical EUCLIDEAN DYNAMICS 291 systems which extend the gcd algorithms. Then, in Section 4, we describe the be- haviour of the main parameters along generic [truncated] trajectories, with the help of transfer operators. After that, Section 5 returns to the discrete case and gcd algorithms themselves. We introduce our main tools, generating functions together with new extensions of transfer operators, which play the rˆole of generating oper- ators. We establish a fundamental relation between these two objects. Then, we perform average-case analysis [Section 6] and finally distributional analysis [Section 7]. Section 8 describes the general framework of functional analysis which is needed. Section 9 provides historical and bibliographic references, describes related works and states numerous open problems.

2. Dynamical Systems. As we already mention it in Section 1.6, the first step aims to find a continuous counterpart to the gcd algorithms, and dynamical systems [or iterated functions systems] will provide such continuous extensions. In the sequel of the paper, the data size plays an important rˆole in generating functions, and we have to build dynamical systems for which transfer operators may be used for generating data sizes. 2.1. Various dynamical systems. We recall some facts about various kinds of dynamical systems, and we define our main notations. Plain complete dynamical systems. Recall that a (plain) dynamical system is a pair formed by a compact set X and a mapping V : X X for which there exists a (finite or denumerable) set , (whose elements are called→ digits), and a topological D partition Xd d∈D of the set X in subsets Xd such that the restriction of V to each { } 2 element Xd of the partition is C and invertible. Here, we are led to so–called complete dynamical systems, where the restriction

V Xd : Xd X is surjective. A special rˆole is played by the set of branches of the| inverse→ function V −1 of V that are also naturally numberedH by the index set : we denote by h the inverse of the restriction V , so that X is exactly the D [d] |Xd d image h[d](X). Since V is a mapping V : X X, the mapping V can be iterated, and the study of dynamical systems aims describing→ iterations of mapping V . The set k is the set of the inverse branches of the iterate V k; its elements are of the H form h[d1] h[d2] h[dk] and are called the inverse branches of depth k. The set ⋆ ◦k ◦···◦ := k is the semi-group generated by . H Given∪ H an initial point x in X, the sequenceH (x) := (x, V x, V 2x, . . .) of iterates of x under the action of V forms the trajectoryV of the initial point x. The map σ : X whose restriction to Xd is constant and equal to d is useful to encode the trajectory→ D (x) with an (infinite) sequence of digits, V (x) := (d (x), d (x),...,d (x),...) with d (x)= σ(V i−1x). (2.1) D 1 2 i i Markovian dynamical systems. We have already observed that most algorithms of Type 2 are Markovian with two states. They will give rise to Markovian dynamical systems (with two states), which we now describe. In this case, X is the union of two sets X<0> and X<1>; when one is in X , one is in state j. Each X has a topological partition X,d d∈D , and, for j = 0, 1, there exists a mapping V : X X. Each{ set } of digits admits a partition into two subsets → D , and, for any d , the restriction V X,d is a surjection onto DX . The set of inverse∈ branches D of V is denoted by| , and there are four H sets , each of them is the set of inverse branches of the restriction of V to theH union X . See Figure 14 for instances of such a situation. ∪d∈D ,d 292 BRIGITTE VALLEE´

Random dynamical systems and iterated functions systems. Here, we mainly deal with random dynamical systems. Consider a compact set X, a sequence of mappings + V(1), V(2),...,V(k),..., and a probability π defined on N . At each step of the process, one chooses the dynamical system (X, V(k)) with probability πk. Now, the trajectory (x) and the encoding (x) become random variables, since they depend on theV random choices that areD made at each step of the process. Finally, at each step of the process, there are two different choices: first, one chooses the mapping V(k) according to probability πk, then the position of x with respect to the topological partition of V(k) determines the branch of the mapping V(k) which will be used in the process. A dynamical system with only one branch is not a priori very interesting, be- cause it describes a process which always performs the same operation. However, a random dynamical system where each dynamical system (X, V(k)) has only one branch may be interesting, since there remains one random choice in this process, namely the choice related to probability π: such a system is called a system of iterated functions [(IFS) in short].

Finally, we will use in the sequel three kinds of dynamical processes: Two kinds of processes, where there is only one source of randomness for choosing the operation of the algorithm (and thus the inverse branch used), — (deterministic) dynamical systems (possibly markovian), where the random- ness is only due to the position of x X [governed by the most significant bits]. This situation arises for Types 0 and 1.∈ — or systems of iterated functions, where the randomness is only due to the probability π (governed by the least significant bits). This situation arises for Type 4. The third kind of process, which is the random dynamical system (possibly markov- ian), contains two sources of randomness, due to the position x X and probability π. This happens for mixed types [Types 2 and 3]. ∈

2.2. Euclidean algorithms and dynamical systems. The main (and simple) idea aims to relate each algorithm to a dynamical system (X, V ), such that the execution of the algorithm on the input (u, v) is closely related to the trajectory V (u/v). Then the set X must contain the set of valid “rationals”, i.e., the set of all “rationals” u/v related to valid input pairs (u, v), the topology which endows X must be “compatible” with the main choices of the algorithm, and the set formed with the “rationals” of X must be dense in X for this topology. In this way, it is possible to get extensions for each LFT used for building continued fractions. And the set of the inverse branches of V must coincide with the set of such extensions of LFT’s. We recall that our final tools are generating functions, defined in Section 1.7, [k] [bivariate as SR(s, w) or univariate as SR (s)] for which we aim to obtain alternative expressions. Our first task is to generate, with these continuous extensions, the inputs, and more precisely the absolute value of the input sizes. Then, we would like the topology on X to be compatible with the notion of size. For the first two types, the topology on X is clearly compatible with the notion of size: Type 0 [polynomial case] is totally ultrametric [both, topology on X and size are ultrametric], while Type 1 [MSB class] is totally archimedean. For these first two Types, we are then led to deterministic dynamical systems. EUCLIDEAN DYNAMICS 293

This compatibility no longer holds for the other types, and there is a conflict between the size and the topology: the size remains archimedean, whereas the topology is no more totally archimedean. The topology of Type 4 is a priori totally dyadic, and for mixed types [Types 2 and 3], the extension should be a double extension, both archimedean (for dealing with operations on most significant bits) and dyadic (for dealing with operations on least significant bits). For all these types [Types 2, 3, 4], we need a double extension, both archimedean and dyadic, where both input sizes and operations performed by the algorithms can be easily generated and extended. Finally, we shall decide to mainly work with real extensions, well– adapted for generating input sizes, and the dyadic topology only translates in a probabilistic way: we shall deal with random dynamical systems, where the partition of X is defined by the most significant bits, whereas probability π is related to the dyadic topology (and the least significant bits). Since Type 4 is not governed at all by the MSB’s, there is only one branch for each dynamical system, and we are led to a system of iterated functions. 2.3. The transfer operator. The main study in dynamical systems concerns it- self with the interplay between properties of the transformation V and properties of trajectories [or encoded trajectories defined in (2.1)] under iteration of the transfor- mation. The behaviour of typical trajectories of dynamical systems is more easily explained by examining the flow of densities. In each case, there exists on X a Haar measure (normalized), and the set X is endowed with some initial distribution rel- ative to some density f = f0. The time evolution governed by the map V modifies the density, and the succes- sive densities f0,f1,f2,...,fn,... describe the global evolution of the system at time t =0, 1, 2, .... For each inverse branch h, the component operator H[h] defined as H [f](x)= h′(x) f h(x). (2.2) [h] | | · ◦ expresses the part of the new density which is brought when one uses the branch h. (Here . denotes the absolute value on X, i.e. the ultrametric absolute value [Type 0] or the| | archimedean absolute value [for all other types]). Then, if the dynamical system is generic, the operator

H := H[h] (2.3) hX∈H is the density transformer, or the Perron-Frobenius operator which expresses the new density f1 as a function of the old density f0 via the relation f1 = H[f0]. It proves convenient to add a (complex) parameter s, and introduce the compo- nent operator H [f](x)= h′(x) s f h(x). (2.4) s,[h] | | · ◦ The transfer operator Hs, defined as

Hs := Hs,[h] (2.5) hX∈H can be viewed as an extension of the density transformer, since the equality H1 = H holds. It admits the following general form H [f](x) := h′(x) s f h(x). (2.6) s | | · ◦ hX∈H For Markovian dynamical systems with two states 0 and 1, the set denotes the set of inverse branches used in the state i, and the set “brings”H the system H 294 BRIGITTE VALLEE´ from state j to state i. If Hs, [resp Hs,], denotes the transfer operator associated to set [resp. ] the transfer operator Hs relative to this Markovian systemH is a “matrix operator”,H

Hs,<0|0> Hs,<0|1> Hs = with Hs, := Hs,[h], (2.7) Hs,<1|0> Hs,<1|1>   h∈HX that operates on pairs f = (f<0>,f<1>) of functions. In the same vein as previously, the transfer operator is an extension of the density transformer H, defined as equal to H1. Until now, we have only defined the transfer operator in the case of deterministic dynamical systems. In the case of a random dynamical defined by a compact set X, a sequence of mappings V(k) and a probability π, the formula (2.3) extends to H := π H k · (k) kX≥1 where H(k) is the density transformer relative to the dynamical system (X, V(k)). Then, for a random dynamical system, the transfer operator will be defined as H [f](x) := πs h′(x) s f h(x). s k | | · ◦ kX≥1 h∈HX(k) It is easy to get a formula of the same vein in the case of a random Markov dynamical system, These transfer operators are a central tool for studying dynamical systems.

2.4. Transfer operator and generation of inputs. Dynamical analysis also uses the transfer operator; however, it uses it (in a non classical way) for generating absolute values of the inputs which appear in a central way in the generating func- tions [see Section 1.7]. Transfer operators can be viewed as “generating operators” since they generate themselves . . . generating functions. Remember that Section 1.4 explained why there are two main cases for defining absolute values of input pairs (u, v): case (a), relative to all types except Type 4, where it is defined in (1.10), and case (b), relative to Type 4, where it is defined in (1.12). (a) For all types except Type 4, the absolute value (u, v) = v of an input of Ω is closely related to the denominator function D[h](x)| taken| at| the| final value x := η [see (1.11)]. Since all the inverse branches are LFTs, the denominator function is itself related to the derivative, via the relation 1 1 = δs h′(x) s with δ := , D[h](x)2s h · | | h det h | | so that the general term of the Dirichlet series SR(s, 0) defined in Equation 1.18 can be written as 1 1 = δs h′(η) s, with δ := . (2.8) (u, v) 2s h · | | h det h | | | | We are then led to deal with (possibly random) dynamical systems where the set of branches h with det h = D is chosen with probability 1/D. Then, the component | | operator Hs,[h] of such a random dynamical system is H [f](x)= δs h′(x) s f h(x)= D[h](x) −2s f h(x), (2.9) s,[h] h · | | · ◦ | | · ◦ EUCLIDEAN DYNAMICS 295 and the transfer operator Hs defined in (2.5) or in (2.7) can be used for generating input data. (b) For Type 4, the absolute value (u, v) of an input of Ω equals the Euclidean norm (u, v) , which coincides with the| Euclidean| norm of the vector M(0, 1) where M is the|| matrix|| built by the execution of the algorithm [remember that the final pair is (0, 1)]. [see Eqn (1.13)]. More generally, we aim to generate the ratios (a,b) 2 || || . (2.10) M(a,b) 2 || || The LFT g associated to matrix M defines a bijection of the projective line. Denote by θ an angle of the torus J := R/πZ which can be identified with the interval ] π/2, +π/2[ (where the two points π/2 and +π/2 are the same), and by Ψ the “tangent”− map. Consider the map g−: J J which is conjugate of g by Ψ and → defined as g := Ψ−1 g Ψ. For a vector (a,b) parallel to (y, 1) with y = a/b = tan θ, one has ◦ ◦ αy + β g(θ) = arctan[g(y)] = arctan , γy + δ   and the derivative g′(θ) satisfies, with D := det g , | | 1+ y2 (a,b) 2 g′(θ)= D = D || || . · (αy + β)2 + (γy + δ)2 · M(a,b) 2 || || Now, for an input (u, v) which equals M(0, 1), one has 1 (0, 1) 2 = || || , (u, v) 2 M(0, 1) 2 | | || || and finally 1 1 = δs g′(0) s with δ := . (2.11) (u, v) 2s g · | | g det g | | | | We are then led to deal with a dynamical process where branches h := g are the conjugates of the LFT’s g produced by the with the tangent map. This will be a random dynamical process where each branch h := g relative to det g = D is chosen with probability 1/D. Then, with δ := δ =1/ det g , the | | g g | | component operator Hs,[h] relative to such a random process is H [f](x)= δs h′(x) s f h(x) (2.12) s,[h] h · | | · ◦ and the transfer operator Hs defined in (2.5) can be used for generating input data.

In both cases (a) and (b), the Dirichlet series SR(s, 0) can be generated with the help of a transfer operator related to a [possibly] random system, as we see from Equations (2.8) or (2.11). However, there is an important difference between these two random processes. The first one [case (a), for all types except Type 4] is a (possibly random) dynamical system, while the second one [case (b), only for Type 4] is a system of iterated functions. In case (a), the set of LFT’s h with det h = D is the set of inverse branches of a dynamical system, and this dynamical| system| is chosen with probability 1/D. Then, if the set X is endowed with some density f, the set h(X) is a proper subset of the set X, and the probability that an inverse branch h [of any depth] is chosen is 1 P[h is chosen] = f(u)du = δ f(u)du. (2.13) det h h | | Zh(X) Zh(X) 296 BRIGITTE VALLEE´

(P 1) Uniform contraction of inverse branches. ρ := max{|h′(x)|; h ∈ Hn,x ∈ X} 1/n < 1. ` ´ (P 2) Bounded distortion. ∃K > 0, ∀h ∈ H, ∀x ∈ X, |h′′(x)|≤ K · |h′(x)|. (P 3) Convergence on the left of s = 1. σ ′ σ ∃σ0 < 1, ∀σ>σ0, δh · sup |h (x)| < ∞ X x∈X h∈H

Figure 2. Good properties of the set H of inverse branches

In case (b), each LFT g with a given determinant D [or its conjugate h := g] is chosen with probability 1/D. Each function h is a bijection h : X X, with X := J, and finally, if the set X is endowed with some density f, the→ probability that a function h [of any depth] is chosen is 1 P[h is chosen] = = δ f(u)du. (2.14) det h h | | Zh(X) Then, the formulae (2.13) or (2.14) are of the same vein, and define a common framework of use. 2.5. Three main classes. It is well-known that the long time behaviour of tra- jectories is closely related to expansion properties of mapping V , or contracting properties of the set of inverse branches of V . More precisely, we introduce three important propertiesH of set in Figure 2. H For dynamical systems of Types 3 and 4, the rˆole of LSB’s is too important to give rise to smooth archimedean dynamical systems. This explains why Property (P 1) does not hold. There are four algorithms of types 3 or 4 : the Binary Algorithm, the Plus-Minus Algorithm and the two versions of the LSB Algorithm. We do not succeed at all analyzing the Plus-Minus Algorithm: we have built a dynamical system, but we do not know how to deal with it. For the other three algorithms which form the so–called Difficult Class, the situation is different: we obtain some important results, even if we do not answer all the main questions concerning the analysis of these algorithms. Dynamical Systems of Type 0, 1, and 2 are easier to analyze (at least a priori), and they form the Easy Class; however, the behaviour of the set of inverse branches [with respect to Properties (P 1, P 2, P 3)] depends on the algorithms.H This gives rise to a partition of Types 0, 1, 2 into two main classes. The first class, which is called the Good Class gathers all the Euclidean Dynamical Systems which satisfy (P 1, P 2, P 3), and all the associated gcd algorithms of the Class will be “fast”. The Second class, called the Bad Class, gathers the other algorithms, that are in fact almost contracting, since the only problem for (P 1) is due to the existence of an indifferent point....The gcd algorithms of the Bad Class will be “slow”. The good dynamical systems give rise to chaotic behaviour of trajectories, while, for the slow ones, the trajectories present an intermittency phenomenon. [See Figure 3]

2.6. The Good Class versus the Bad Class. Induced dynamical systems. For dynamical systems of the Good Class, the density transformer H acts on 1(X) C EUCLIDEAN DYNAMICS 297

Figure 3. Chaotic Orbit [Good Class], Intermittent Orbit [Bad Class]. functions; furthermore, it has a unique dominant eigenvalue λ = 1, with an as- sociated dominant eigenfunction ψ which is also an invariant function. Moreover, there is a spectral gap, and the rest of the spectrum lies in a disk of radius < 1.

Furthermore, with the condition X ψ(t)dt = 1, [where dt is the Haar measure on X], the function ψ is unique too. R Two constants will play a crucial rˆole in the sequel. The entropy α of such a system is well–defined, with the help of Rohlin’s formula which can be written here as ′ α = δh log δh log V (t) ψ(t)dt. (2.15) − − X | | hX∈H Z The average µ(c) of a digit-cost c of moderate growth with respect to measure ψ(t)dt,

µ(c)= δh c(h) ψ(t)dt (2.16) · · h(X) hX∈H Z plays also an important rˆole in the paper. The situation is quite different for the algorithms of the Slow Class: The invariant function ψ is singular at the point η which is the stopping value for the algorithm. The reason is that this point η is indifferent under the action of V : it is a fixed point for V with a derivative whose absolute value is equal to 1 (i. e. V (η) = η, V ′(η) = 1). See Figure 10. Then, the typical trajectory admits a quite different form,| since,| when it arrives near this point, it passes many times near it. As this point η is (weakly) repulsive, the rational trajectories that eventually finish at this point η, will attain it after a long time. Then it is (at least intuitively) clear that the relative Euclidean algorithms will be “slow”. However, the induced dynamical system which “forgets” all the sub-trajectories that stay near the indifferent point η admits typical trajectories that again exhibit a chaotic behaviour. The notion of induction was introduced by Bowen [13]. Be- ginning with a dynamical system (X, V ), the induced system (X, V ) is defined in a more formal way as follows: If p denotes the “bad” inverse branch that contains the indifferent point η and denotes the set p of good inversee e branches, the Q H\ interval X is defined as X := X p(X)= h(X). e \ h[∈Q The induced shift mapping eV : X X is then defined from the first iterate of V → that returns into X: if n(x) is the smallest integer k 0 such that V k(x) X, then ≥ ∈ we let V (x) := V n(x)+1(x). Thise means that V (x) equals V (x) for x X while, for e ∈ e e e e 298 BRIGITTE VALLEE´ x X, V (x) equals V (y) where y is the first iterate of x that belongs to X. Then the 6∈ trajectory (x, V x, V 2x, . . .) is exactly the trajectory (x, V x, V 2x, . . .) which forgets all thee sub-trajectoriese that stay near the indifferent point η, whereas thee set of H inverse branchese ise exactly the set = p⋆ where one groups a sequence of bad LFTs with a good one. Now, the followingH Q result will be very important fore the sequel: e For any algorithm of the Slow class, the set satisfies properties (P 1, P 2, P 3) of Figure 2, and the induced system is good. H Consider the operators Q , P relative to thee sets p , , s s { } Q Qs := Hs,[h], Ps := Hs,[p] hX∈Q which satisfy Ps + Qs = Hs, and consider, as in [82], the transfer operator Hs of this induced dynamical system. It involves the operators Qs, Ps under the form e H = Q Pk = Q (I P )−1, so that H (I P )= Q . (2.17) s s ◦ s s ◦ − s s ◦ − s s kX≥0 Sincee the operator H admits an invariant density ψ whiche satisfies H[ψ]= P[ψ]+ Q[ψ]= ψ, the function g := Q[ψ] = (I P)[ψ] satisfies − H[g]= H (I P)[ψ]= Q[ψ]= g, ◦ − so that (I P)[ψ] is an invariant function for H. Furthermore, the semigroup ⋆ − H can be written as ⋆ pe⋆. However,e the rational trajectories stop as soon as they reach the stoppingH value· η. Since η is a fixed pointe for the bad branch p, the rational trajectories only usee the LFT’s which do not finish with p, and they use exactly the semi-group ⋆. Consequently, we may replace in our study the quasi-inverse H (I H )−1[1][η) by its induced form (I H )−1[1][η), and this helps a lot since the − s − s tilde operator, relativee to set has now good properties. H e 2.7. Transfer operators viewed as generating operators. Finally, in each e case, the transfer operator is written as a sum of operators Hs,[h] taken over some set, in (2.5), sets i|j for (2.7). In each case, the n-th iterate of the operator has exactlyH the same expressionH as the operator itself, except that the sum is now taken over the n–th power of the initial set, namely n in (2.5), sets [n] for (2.7) [which H Hi|j bring data from state i to state j in n steps]. This fact is due to the multiplicative properties of derivatives, denominators, matrices, probabilities, determinants.... In a very general sense, the n-th iterate of the transfer operator describes the data after n iterations. Then, the evolution of data during all the possible executions of the algorithm, correspond to the semi–group ⋆ for generic algorithms. For Markovian H algorithms, it is related to the four sets [⋆] [which bring data from state i to Hi|j state j in an arbitrary (but finite) number of steps]. We are led to work with the quasi-inverse of the transfer operators. Each of these quasi–inverses generates all the possible iterations, and, in a quite general framework, the operator (I H )−1[1](η) [η is the final value of the algorithm] − s will generate all the input sizes. This is why these quasi-inverse will play a central rˆole in our study. In the following, we use extensions of the various transfer operators introduced in (2.5, 2.7) [see Figure 4]. When we wish to study a parameter R relative to EUCLIDEAN DYNAMICS 299

Name Definition of component operator H s ′ s s δh · |h (x)| · f ◦ h(x) H s ′ s Plain s δh · |h (x)| · F (h(x),y) H s ′ s b s δh · |h (x)| · F (h(x), h(y)) H s ′ s s,w,(c) δh · exp[wc(h)] · |h (x)| · f ◦ h(x) H s ′ s Weighted s,w,(c) δh · exp[wc(h)] · |h (x)| · F (h(x),y) H s−w ′ s ′ −w b s,w δh · |h (x)| · |h (y)| · F (h(x), h(y)) H(c) H s ′ s s := (∂/∂w) s,w|w=0 δh · c(h) · |h (x)| · f ◦ h(x) H(c) H s ′ s Various s := (∂/∂w) s,w|w=0 δh · c(h) · |h (x)| · f ◦ h(x) H H s ′ ′ s Derivatives ∆b s := (d/ds) bs δh · (log |h (x)| + log δh) · |h (x)| · f ◦ h(x) H H s ′ ′ s ∆ s := (∂/∂w) s,w|w=0 −δh · (log δh + log |h (y)|) · |h (x)| · F (h(x), h(y)) Figure 4. Definition of operators via their component operators. [re- mark that f denotes a function of one variable, and F a function of two variables]

Total costs Beginning Ending Bit-Complexity continuants continuants H H Real Trajectories 1,w,(c) 1,w ————- ——— (Section 4) H H(c) H H H H H(ℓ) Rational Trajectories s , s s, s,0 s s, s b H(ℓ) H (average) (Sections 5 and 6) s , s,0 H H H H H b Rational Trajectories s,w,(c) s, s,w s−w, s ———- (distribution) (Section 7) b

Figure 5. Main transfer operators used in the analyses. a Euclidean Algorithm, we add an extra parameter [called w] inside a transfer operator Hs in order to obtain a weighted transfer operator of the form Hs,w,(c) [which operates on functions of one variable]. For continuants, we will also deal with an underlined version Hs,w and, also sometimes, with an “hat” version Hs,w of the transfer operator. Note that these last two versions of the transfer operator operate on functions of two variables, even if the “hat” version does not modifyb the second variable y. 2.8. The nine Theorems. In this paper, we state nine Theorems, numbered from 1 to 9 [cf Figure 6]. The first two Theorems [Theorems 1 and 2], stated in Section 4, describe the behaviour of generic truncated trajectories, from the digit–point of view [Theorem 1] or from the continuant point of view [Theorem 2]. Then Sections 5 and 6 perform the average–case analysis of Euclidean Algorithms, and then study the average behaviour of the particular rational trajectories. Here, four Theorems are stated [Theorems 3, 4, 5, 6]. Theorems 3 and 4 are relative to the average–case analysis of additive costs, whereas Theorem 5 provides an average case analysis of the continuants [ending or beginning] at a given fraction of the depth. Theorem 6 is devoted to the average-case analysis of the bit–complexity cost. Finally, Section 7 performs distributional analysis of additive costs [Theorem 7] and continuants [Theorem 8], and finally states results on the distributional analysis of the bit– complexity cost [Theorem 9]. Figure 6 summarizes the subject of the nine theorems. Figure 7 describes the constants which intervene in the dominant terms of the various expectations and 300 BRIGITTE VALLEE´

Additive costs Beginning Ending Bit-Complexity continuants continuants Real Trajectories Thm 1 Thm 2 ————- ——— (Section 4) Rational Trajectories Thms 3 and 4 Thm 5 Thm 5 Thm 6 (average) (Sections 5 and 6) Rational Trajectories Thm 7 Thm 8 ——– Thm 9 (distribution) (Section 7) Figure 6. The subject of the nine theorems

Constants for the expectations ′ ′ µ(c) = Λw(1, 0), α = |Λs(1, 0)|. Alternative forms for these constants are given in (2.15) and (2.16).

Theorem 1 µ(c)

Theorem 2 α/2

Theorem 3 and 7 µ := (2 log 2)/α b Theorem 4, 6, 7, 9 µ(c)= µ · µ(c) b b Theorem 5 and 8 δ

Constants for the variance

′′ ′′ ′′ γ := Λs2 (1, 0), ρ(c) = Λw2 (1, 0), χ(c) = Λsw(1, 0). No alternative form is known for these constants.

Theorem 1 ρ(c)

Theorem 2 γ/4

Theorem 7 ρ := 2 log 2 · (γ/α3) b Theorems 7 and 9 ρ(c) := µ2(c) · ρ2 + µ · ρ2(c)+ µ2µ(c) · χ(c) b b b b Theorem 8 δ(1 − δ) · (γ/α)

Figure 7. Constants in the dominant terms of the expectation and variance. Λ(s, w) is the pressure, i.e., Λ(s, w) := log λ(s, w), where λ(s, w) is the dominant eigenvalue of the transfer operator Hs,w

variances studied in these theorems. It exhibits the crucial rˆole played by the pressure function Λ(s, w) [which is the logarithm of the dominant eigenvalue λ(s, w) of the transfer operator Hs,w], since all the constants of the paper involve its first five derivatives (two derivatives of order 1 and three derivatives of order two). EUCLIDEAN DYNAMICS 301

UDE Unique Dominant Eigenvalue at (1, 0) SG Spectral Gap at (1, 0)

Anw(1, 0) The map w 7→ H1,w is analytic at w = 0

Ans(s, 0) The map s 7→ Hs,0 is analytic for ℜs>σ0 with σ0 < 1

Ans,w(s, 0) The map (s, w) 7→ Hs,w is analytic for ℜs>σ0 and w near 0, with σ0 < 1 SM Strict Maximum on the Vertical Line attained at s = σ ∀σ(real), ∀t 6= 0, R(σ + it, 0) < R(σ, 0) US Uniform Estimates on Vertical Strips :

∀ξ > 0, ∃M > 0, t0 > 0, such that ∀n, ∀(σ, ν)(real) near (1, 0) Hn n ξ ∀s = σ + it, w = ν + iτ, |t| >t0, || s,w||1,t ≤ M · γ · |t|

SLCw Strict log convexity of w 7→ log λ(1, w) at 0 SLC Strict log convexity of w 7→ log λ(1 + qw,rw) at 0 for any (q,r) 6= (0, 0)

Figure 8. Main analytical properties of the operator Hs,w, its domi- nant eigenvalue λ(s, w) and its spectral radius R(s, w) (on a convenient functional space). Note that ||.||1,t is some norm (depending on the imaginary part t of s) described in Section 7.

Average-case Distribution Truncated UDE + SG UDE + SG

real trajectories + Anw(1, 0) + SLCw Rational UDE + SG UDE + SG

trajectories + Ans(1, 0) + SM + Ans,w(1, 0) + US + SLC

Figure 9. Properties of the transfer operator useful for analyzing trajectories.

Sections 4, 5, 6, 7 will describe, for each analysis, the convenient operator: it depends on the parameter to be studied, but also on the whole framework: contin- uous or discrete, average-case analysis or distributional analysis. Figures 4 and 5 summarize the operators used and the context of their use. Figures 8 and 9 describe the main properties of the operator which are needed for the various analyses performed in the paper. Section 8, and particularly Figure 21 of Section 8, will provide the convenient functional spaces [depending on the algorithms] where such properties will be proven to hold. F

3. First Step: Building the Euclidean dynamical Systems. We are now ready for performing the first step of dynamical analysis: we aim to build, for each Euclidean Algorithm, a dynamical system which extends the operations of the algorithms, and whose transfer operator can be used as a generating operator. We describe here, in this Section, the characteristics of the dynamical system relative to each Euclidean Algorithm. Even if these systems share important properties –for instance, all their branches are LFT’s–, their main characteristics may vary in a significant way. The class of Euclidean systems contains in fact quite different systems, whose analysis does not seem [a priori] to be performed in a common framework.

3.1. The Euclidean dynamical systems for Type 0. As we already mentioned it in Section 1.1, there are two divisions on polynomials; the first one is directed 302 BRIGITTE VALLEE´ by leading monomials (i.e., monomials of highest degree) and deals with decreasing degrees. The second one is directed by monomials of lowest degree and deals with increasing valuations.

The first gcd algorithm on polynomials with coefficients in the finite field Fq with q elements is based on the Eucldean division (with decreasing degrees) on a pair (u, v) of polynomials with deg v > deg u, v = m u + r, with r =0 or deg r< deg u. · The analogue of the ring Z is the ring Fq[Z], and the field Fq(Z) plays the same rˆole as the field Q of rational numbers. We work on the completion of Fq[Z] with respect to the (ultrametric) absolute value . defined as u := qdeg u: this is the | | | | field of Laurent formal power series Fq((1/Z)) where each element f has a Hensel expansion f = f (1/Z)n, with f F and n Z. (3.1) n n ∈ q 0 ∈ nX≥n0 This expansion is parallel to the binary expansion of a real [replace Z by 2]. From the Hensel expansion (3.1), it is possible to define the function integer part, denoted by . , and the function fractional part, denoted with . , with ⌊ ⌋ { } 0 f := f (1/Z)n f := f (1/Z)n. ⌊ ⌋ n { } n n=n X0 nX≥1 The convenient set X is the unit open ball q of Fq((1/Z)), which is also the set of elements with zero integer part, and the shiftX V : is defined by Xq → Xq 1 1 1 V (x)= = . for x =0, V (0) = 0. x − x x 6     The set of digits is D := m F [Z]; m > 1 = m F [Z]; deg m> 0 . D { ∈ q | | } { ∈ q } This dynamical systems is precisely described for instance in [11]. The second gcd algorithm on polynomials is based on the division (with increasing valuations) on a pair (u, v) of polynomials with val u> val v =0. If a denotes the valuation of u, the division step can be written as u := Za u′, v = m u + r, with r =0or val r> val u, r := Za r′, · · · and the new pair is (u′, r′). This division on (u, v) gives rise exactly to the Euclidean division on the mirror pair (v, u) defined by 1 1 v(Z) := Zn v( ), u(Z) := Zn u( ) with n := max(deg v, deg u) · Z · Z These two divisions are “conjugated” via the mirror application, and their associated dynamical systems have exactly the same properties. We shall see that the situation is quite different for integers. The Euclidean dynamical system possesses, in the polynomial case, very partic- ular properties. The density transformer, and its extension the transfer operator, mainly deals with the absolute values h′(x) of derivatives of inverse branches h, | | for x q. And, in the polynomial case, thanks to the ultrametric topology on q, this absolute∈ X value h′ (x) is constant on and equals to m −2. Then, whenX | [m] | Xq | | EUCLIDEAN DYNAMICS 303 applied to uniform density f0 = 1, the transfer operator Hs transforms it into a constant function 1 1 H [1] = = . s m 2s q2s deg m mX∈D | | mX∈D This Dirichlet series is in fact a power series in z = q−2s. It coincides with the (usual) generating function D(z) of the set , which gathers all the non constant D polynomials of Fq(Z), q(q 1)z q 1 H [1] = D(z)= zdeg m = (q 1) qnzn = − = − . s − 1 qz q2s−1 1 mX∈D nX≥1 − − The entropy of the dynamical system is equal to 1 (1/q). Of course, it is easier to deal with power series than− with Dirichlet series. This is why the polynomial case is easier than the number case [as it is usual in the mathematical life, since there are no carries for polynomials . . . ]. 3.2. The Euclidean dynamical systems for Type 1. The main features of MSB-gcd’s are described in Figure 1. All the continuous extensions of the MSB- gcd’s lead to dynamical systems where X is a real compact interval endowed with the usual absolute value [see Figure 10]. For surveys on dynamical systems on a real interval, see [17], [22]. For Type 1, there are many different possible generalizations for the integer part function which can be defined from the binary expansion of a . Such possible generalizations are described in Figure 3. All the mappings V [except for the Subtractive algorithm] are of the form 1 1 V (x) := A , x − x   for some function A [See Figure 11], which generalizes the integer part function. The Subtractive Dynamical system is defined on the unit interval X; it has two branches x 1 x V (x)= , or V (x)= − , 1 x x according as (1 x)/x belongs to− X or not, and its two inverse branches are − 1 x p(x)= , q(x)= . (3.2) 1+ x 1+ x See Figure 12 for a description of Subtractive Algorithm. Transfer operators relative to some algorithms of Type 1 are very classical. For instance, the transfer operator associated to the Standard Euclidean Algorithm was introduced by Gauss himself; it can be written as 1 2s 1 H [f](x) := f s m + x · m + x mX≥1     For the subtractive algorithm, one has: 1 2s 1 x H [f](x) := f + f s 1+ x · 1+ x 1+ x        There are three algorithms of Type 1 [the Classical Algorithm (G), the Centered Algorithm (K), and the Odd Algorithm (O)] which belong to the Good Class (they correspond to the left column of Figure 10), and three algorithms of Type 1 [the 304 BRIGITTE VALLEE´

Even Algorithm (E), the By-Excess Algorithm (M), and the Subtractive Algorithm (T )] which belong to the Bad Class (they correspond to the right column of Figure 10). As we already explained in Section 2.6, in the case of algorithms of the Bad Class, we consider the induced dynamical systems. Figure 13 describes the main properties of the induced Dynamical systems (M), (E), (T ). Note that system (T ) is exactly the Classical Euclidean System (G). For all these systems, the invariant density isf explicit,e aned given in Figures 11 ande 12. Then, with Rohlin’s Formula [see Equation (2.15)], the entropy is also explicit (when it exists), and this is the same for the entropy of the induced dynamical systems [cf Figures 11,12,13].

3.3. The Euclidean dynamical systems for Types 2 and 3: generalities. How to obtain extensions for gcd’s of the mixed groups? In fact, these gcd algo- rithms work partly with LSB’s, but the size remains archimedean. Then, (as we already announced it), we choose to mainly work with real extensions, where the influence of LSB’s leads to a probabilistic framework. We consider first the behaviour of a step of the gcd algorithm when the total binary shift a + b [see Equation (1.1)] equals k, and we extend it to real numbers of X: this defines a dynamical systems (X, V(k)), where all the reals behave as if they use a total shift equal to k. In this case, the set of the inverse branches of (X, V(k)) is denoted by (k), and the absolute value of the determinant of any LFT k H of (k) equals 2 . For a further extension, we need to extend the total shift on real numbersH of X. We have already explained (in Section 2.4) why it is convenient to extend it in a probabilistic way, into a random variable on X, according to the law P[k = d]=2−d (for d 1). ≥ Finally, the whole process gives rise to a probabilistic dynamical system (X, V˘ ) defined as follows. At each time t, one chooses first the random binary shift k −d according to the previous law P[k = d]=2 (for d 1), then we choose V(k) as ≥ ˘ the mapping for this step, and, for any x X, the next point is V (x) := V(k)(x). ˘ ∈ The set of all possible inverse branches is then the (disjoint) union of sets (k) for k 1.H In such a way, we extend a deterministic gcd algorithm into a randomH algorithm,≥ and we can define (random) continued fraction for real numbers. Remark that now rational numbers themselves have random continued fraction expansions, and, amongst all these expansions, one can find the finite continued fraction of the rational. Now, we make precise this probabilistic extension for each type [first Type 2, then Type 3].

3.4. The Euclidean dynamical systems for Type 2. [106] [107]. Consider four Euclidean divisions of Type 12, namely the standard division (G), the centered division (K), the Odd Division (O) and the By Excess division (M). Each of them can be slightly modified in the following way: the Euclidean division is performed as usual, and, after the division [or, more exactly, before the following division], the powers of two are removed from the remainder, in order to obtain an odd value for

2 for the remaining two divisions, the situation is different, since the pseudo-version of the Subtractive Algorithm will be the Binary Algorithm, which belongs to Type 3, and the pseudo- version of the Even division coincides with the Even Division. EUCLIDEAN DYNAMICS 305

Figure 10. The six Euclidean Dynamical systems of the MSB Group [Type 1] ; on the left, Standard (G), Odd (O), Centered(K); on the right, By-Excess (M), Even (E), Subtractive (T ). Note the presence of an indifferent point for each system on the right column: η = 1 for (M) and (E) – η = 0 for (T ). u′. Each pseudo-division step can be written as

u := 2a u′, v = m u′ + ǫr, r′ := r, · · and the LFT h relative to this division is 2a h(x) := . m + ǫx 306 BRIGITTE VALLEE´

Alg. Function A(x) Invariant function ψ Entropy Bad LFT p Class. 1 1 π2 (G) Integer part of x ——- Good log 2 1+ x 6 log 2 (M) Smallest integer 1 1 at least equal to x Not defined. Bad 1 − x 2 − x 1 1 1 π2 (K) Nearest integer to x [ + ]. ——- Good log φ φ + x φ2 − x 6 log φ 1 1 1 (E) Even integer nearest to x + Not defined Bad 1 − x 1+ x 2 − x 1 1 π2 (O) Odd integer nearest to x + ——- Good φ − 1+ x φ2 − x 9 log φ

Figure 11. The first five Euclidean dynamical systems [Type 1]. Here, the shift mapping V and the encoding mapping σ are defined from func- 1 1 1 tion A, with the formula V (x) := | − A( )|, σ(x) := A( ) . x x x

Alg. Function V (x) ψ Entropy Bad LFT p Class. x for 0 ≤ x ≤ 1/2; 8 1 − x > > 1 x (T ) V (x) := <> 1 − x Not defined Bad. for 1/2 ≤ x ≤ 1 x 1+ x x > > :> Figure 12. The dynamical system relative to the Subtractive Algorithm.

Induced Alg. Invariant function ψ Entropy h(H) e e 1 1 π2 (M) log 2 2 − x 3 log 2 f 1 1 1 π2 (E) [ + ] log 3 3 − x 1+ x 2 log 3 e 1 1 π2 (T )= (G) log 2 1+ x 6 log 2 e

Figure 13. The induced dynamical systems relative to the three “bad” systems of Type 1.

The pseudo-Euclidean Algorithms are described in Figure 15. We recall that pseudo- Euclidean algorithms deal with odd inputs, and create a binary shift b equal to 0 [see Section 1]. Then, they are of Markovian type, since there is a relation between parity of the quotient mi at step i and the exponent ai+1 at the beginning of the i + 1-th step: if mi is odd, then the remainder is even, and thus ai+1 satisfies ai+1 1; if mi is even, then the remainder is odd, and thus ai+1 equals 0. We then consider≥ two states: the 0–state, which means “the previous quotient of (v,u) is even” (or equivalently the previous remainder is odd), i.e., the present shift a equals 0; the 1–state, which means “the previous quotient of (v,u) is odd” (or equivalently the previous remainder is even), i.e., the present shift a satisfies a 1. Then, the processus uses four different sets , where brings rationals≥ H H EUCLIDEAN DYNAMICS 307

Alg., X, η Division Set of LFT’s Conditions v = mu + ǫ2k s 2k O˘ = { , ǫ = ±1,m odd, (O˘) [0, 1], 0 m odd, ǫ = ±1, s odd (k) m + ǫx J = O k ≥ 1, 0 ≤ 2ks < u (m, ǫ) ≥ (2k, +1)}

G˘<0> = G, G˘<1> = G˘<1>,(k) k [ v = mu + 2 s k≥1 ˘ ˘ k I = G<0> (G) [0, 1], 0 s = 0 or s odd, k ≥ 0 2 k G˘ = { ,m ≥ 2 } F = G˘<1> 0 ≤ 2ks < u <1>,(k) m + x G˘ = G˘ ∩ {m ≡ i mod2}

M˘ <0> = M, M˘ <1> = M˘ <1>,(k) k [ v = mu − 2 s k≥1 ˘ ˘ k I = M<0> (M) [0, 1], 1 s odd, k ≥ 0 2 k M˘ = { ,m> 2 } F = M˘ <1> 0 ≤ 2ks < u <1>,(k) m − x M˘ = M˘ ∩ {m ≡ i mod2} K˘ = K, K˘ = K˘ <0> <1> [ <1>,(k) k k≥1 v = mu + ǫ2 s k ˘ ˘ 2 I = K<0> (K) [0, 1/2], 0 s = 0 or s odd, k ≥ 0 K˘<1>,(k) = { , k u m + ǫx F = K˘<1> 0 ≤ 2 s< k+1 2 ǫ = ±1, (m, ǫ) ≥ (2 , +1)}

= K˘ ∩ {m ≡ i mod2}

Figure 14. The four pseudo-Euclidean algorithms. from state i to state j. The initial state is always the 0–state and the final state is always the 1–state. In State 1, the mapping of a pseudo–Euclidean Algorithm is defined from the map- k ping V of the related Euclidean Algorithm with V(k)(x) := V (x/2 ), so that the set of the inverse branches of V is H(k) (k) = g; g(x):=2kh(x) with h such that 2kh(X) X , H(k) { ∈ H ⊂ } and its elements are of determinant 2k. There are three algorithms of Type 2 which belong to the Good Class, and these algorithms are the pseudo-versions of the “good” algorithms of Type 1, namely (G˘), (K˘ ), (O˘). On the otherside, the algorithm (M˘ ) belongs to the Bad Class. Re- mind that the pseudo-version of the Even Algorithm coincides with its plain version [because all the are always odd]. We will see that the pseudo-version of the Subtractive Algorithm is the Binary Algorithm, which we now describe.

3.5. The Euclidean dynamical systems for Type 3. For the LMSB Group which contains two divisions, the Binary division or the Plus-Minus Division, the main decision is taken by the LSB’s. The Binary algorithm operates on pairs of odd integers that belong to the set Ω := (u, v), u,v odd, 0 < u v . The binary division creates zeroes on the left of v, and{ builds a quotient m ≤such} that r := v m u is strictly smaller than u: it − · ise directed both by the least significant bits (for creating zeroes on the left) and by the most significant bits (for deciding the moment of the exchange). The Binary Algorithm is described in Figure 16. The Binary division corresponds to each inner loop and is performed on associ- ated rationals as follows: For a pair (u, v) formed with odd integers, the rational 1/x = v/u [0, 1] has a 2-adic norm equal to 1: It belongs to the set U of 2-adic ∈ 2 308 BRIGITTE VALLEE´

State 1 State 1

State 0 State 0

State 0 State 1 State 0 State 1

State 1 State 1

State 0 State 0

State 0 State 1 State 0 State 1

Figure 15. Two examples of Euclidean Dynamical Systems relative to Type 2. Above, Algorithm G˘ [Pseudo-Standard] with k = 1 and k = 2. Below, Algorithm K˘ [Pseudo-Centered] with k = 1 and k = 2.

Input: (u, v) Ω := (u, v), u,v odd, 0 < u v ; ∈ { ≤ } While u = v do e While6 u < v do b b := val2 (v u); v := (v u)/2 ; Exchange u and− v; − Output: u (or v).

Figure 16. Description of the Binary Algorithm units. Then the 2-adic valuation b of z := (1/x) 1 satisfies b 1 and y := 2−bz again belongs to U and is positive. There are− now two cases:≥ if y 1 then 2 ≤ V(b)(x) := y, else V(b)(x):=1/y. Finally, the dynamical system ([0, 1], V(b)) has two branches x 1 1 1 x 1 V (x)=2b if x , V (x)= − if x , (b) 1 x ≤ 2b +1 (b) 2b x ≥ 2b +1 − and its inverse branches can be defined by means of inverse branches of the Sub- tractive Algorithm x x 1 p (x)= p = , q (x)= q 2bx = , (3.3) (b) 2b x +2b (b) 1+2bx    EUCLIDEAN DYNAMICS 309 so that the Binary Algorithm is a pseudo-version of the Subtractive Algorithm; however the mixing between the binary shift and branches p, q of the Subtractive System is more involved than above [See Figure 17]. The density transformer H of the Binary Euclidean System, defined as 1 1 1 x H[f](x) := ( )2 f( )+ ( )2 f( ), (3.4) 1+2bx 1+2bx x +2b x +2b Xb≥1 Xb≥1 was introduced by Brent [14] in his study of the binary gcd, but it is not easy to deal with. This is why the “induced version” of the transfer operator has been further introduced by Vall´ee [105]. Between two exchanges, there is a sequence of internal loops (composed with subtractions and binary shifts) that can be written as

b1 b2 b3 bℓ v = u +2 v1, v1 = u +2 v2, v2 = u +2 v3, ... vℓ−1 = u +2 vℓ, ′ ′ with vℓ < u. Then, we let r := vℓ and we exchange u and r . Formally, this sequence can also be written as u/v = p p . . . p q (v /u), (b1) ◦ (b2) ◦ ◦ (bℓ−1) ◦ (bℓ) ℓ [where p(b) and q(b) are inverse branches of shift V(b) defined in (3.3)]. Note that we use here the operation of induction described in Section 2.6, with respect to the “bad” inverse branch p : we form sequences of branches p followed with the “good” inverse branch q. An elementary step of this induced process is summarized by the k relation v = mu +2 vℓ where m is an odd integer equal to m =1+2b1 +2b1+b2 +2b1+b2+b3 + . . . +2b1+b2+b3+...+bℓ−1 , while the exponent k is equal to k = b1 + b2 + b3 + . . . + bℓ−1 + bℓ. If x = x0 denotes the rational u/v at the beginning of an internal loop, the global result of an elementary step of this induced process is the rational x1 = vℓ/u, defined by 1 x = h(x ) with h(x) := , with m odd, 1 m< 2k, and k 1. 0 1 m +2kx ≤ ≥ (3.5) The transfer operator relative to the induced process is then 1 2 1 H[f](x) := f (3.6) m +2kx m +2kx k≥1 m odd,     X 1≤Xm<2k e The Plus-Minus division is similar; it is just a refinement of the Binary Division. For any x U , amongst ∈ 2 1 1 V (x) := 1, V (x) := +1, − x − + x there is exactly a unique ǫ = 1 for which Vǫ(x) has a valuation b that satisfies b 2, and we choose this V (x)± as our y. For any (ǫ,b), with ǫ = 1 and b 2, we ≥ ǫ ± ≥ build a dynamical system ([0, 1], V[ǫ,b]) which has two branches of the form x 1 1 1 ǫx 1 V (x)=2b if x , V (x)= − if x . (ǫ,b) 1 ǫx ≤ 2b ǫ (ǫ,b) 2b x ≥ 2b ǫ − − − This modelisation appeared for the first time in [23]. 1−b Remark that the image of the unit interval by the branch V(−,b) equals [2 , 1], so that the Dynamical System is no longer complete. . . : this is a main difference between the two algorithms of Type 3. [See Figure 17 below]. As previously, the 310 BRIGITTE VALLEE´

Figure 17. The Euclidean Dynamical Systems relative to Type 3. Above, the Binary Algorithm, with b = 1, b = 2, then b = 1 and b =2on the same figure. Below, the Plus-Minus Algorithm, with ǫ = −1,b = 2, ǫ = −1,b = 3, then b = 2 and b = 3 on the same figure. induced system can be built. Between two exchanges, there is a sequence of internal loops (composed with subtractions, additions and binary shifts) that can be written as

b1 b2 bℓ v = ǫ1 u +2 v1, v1 = ǫ2 u +2 v2, ... vℓ−1 = ǫℓ u +2 vℓ, ′ ′ with vℓ

b1 b1+b2 b1+b2+b3+...+bℓ−1 m = ǫ1 + ǫ2 2 + ǫ3 2 + . . . + ǫℓ 2 , while the exponent k is equal to k = b1 + b2 + b3 + . . . + bℓ−1 + bℓ. If x = x0 denotes the rational u/v at the beginning of an internal loop, the global result of an elementary step of this induced process is the rational x1 = vℓ/u, defined by 1 x = h(x ) with h(x) := , (3.7) 0 1 m +2kx where the possible values of “digits” (m, k) are = d = (m, k), k 2 and m odd , m m(k) , D { ≥ | |≤ } where m(k) equals (2k 1)/3 if k is even and (2k 5)/3 if k is odd. − −

3.6. The Euclidean dynamical systems for Type 4. The LSB algorithms op- erate on pairs of integers that belong to the set Ω := (u, v), v odd,u even . If a is the number of zeroes on the left of u [ i.e., a := Val ({u)], then u′ := 2−a u} is odd. 2 · The LSB division creates zeroes on the left of v,e and builds a quotient m such that r := v m u′ has a number b of zeroes on the left strictly greater than a. Then r and u −are both· multiples of 2a, and the relations u′ := 2−a u, r′ := 2−a r defines · · an integer pair (u′, r′) which will be an element of Ω and the new pair for the next step. It is easy to see that this (plain) quotient m satisfies the three conditions : m odd, m 1, m< 2a+1. It is of course possible toe center the quotient m, so that ≥ EUCLIDEAN DYNAMICS 311

Input: (u, v) Ω; ∈ Repeat −a a := Val2 (u); u := 2 u; b := 0; m := 0 While b a do · ≤ k k := Val2 (v u); v := (v u)/2 ; m := m +2b−; b := b + k; − (*) If m> 2a, then [m := m 2a+1; v := v +2a+1 u; ] Exchange u and v; − · until u = 0. Output: v .

Figure 18. Description of the LSB Algorithms. The line (∗) is only executed for the centered LSB algorithm. this (centered) quotient m satisfies the three conditions: m odd, m < 2a [see Line (*) in Figure 18]. | | The algorithms are then completely governed by the least significant bits. Figure 18 describes two gcd algorithms; each algorithm is relative to a LSB division, the plain LSB division or the centered LSB division. The centered LSB algorithm was introduced in [98], because the plain LSB division does not always terminate. It loops forever for instance on integer pairs of the form (u, v) = ( 2v, v). However, we shall prove in the sequel that the average number of iterations− is finite. The (plain) LSB algorithm uses the set of matrices, M 0 2a := ; a 1,m odd , m < 2a , (3.8) M 2a m ≥ | |    while the (centered) LSB algorithm uses the set ˇ of matrices, M 0 2a ˇ := ; a 1, m odd , 1 m< 2a+1 . (3.9) M 2a m ≥ ≤    Each algorithm uses a set [resp ˇ] of LFT’s of the form g(x)=2a/(m +2ax), where the odd m satisfies theG plainG condition 1 m< 2a+1 [for ] or the centered ≤ G condition m < 2a [for ˇ]. As we already explained in Section 2.4, we are then led | | G to work with a system [resp. ˇ] of iterated functions, defined as H H := h := g; g , ˇ := h := g; g ˇ L { ∈ G} H { ∈ G} where the underline is the conjugaison with the Tangent map, and [resp. ˇ ] is G G the set of LFT’s relative to set [resp. ˇ ] of matrices used by the LSB algorithm. Then, each inverse branch h ofM the formM 2a h(θ) = arctan m +2a tan θ   is chosen with probability 2−2a. Finally, the transfer operator which will be used in the analysis is 1 + tan2 θ 2k H[f](θ) := f arctan , (3.10) 22k + (m +2k tan θ)2 · m +2k tan θ k≥1 m odd    X |mX|<2k in the case of the LSB centered algorithm, for instance. 312 BRIGITTE VALLEE´

Group Type Generic or Pure or Good, Bad or Name Markovian Mixed Difficult Po 0 Ge Pure [U] Good Standard [P oG] Good Standard [G] Good Odd [O] MSB 1 Ge Pure [A] Good Centered [K] Bad By-Excess [M] Bad Even [E] Bad Subtractive [T ] MLSB 2 Ma Mixed Good Pseudo- Standard [G˘] Good Pseudo-Odd [O˘] Good Pseudo-Centered [K˘ ] Bad Pseudo-By-Excess [M˘ ] LMSB 3 Ge Mixed Difficult Binary [B] Not studied Plus-Minus [P M] LSB 4 Ge Mixed Difficult Plain LSB [L] Difficult Centered LSB [Lˇ]

Figure 19. Main features of the Euclidean Dynamical Systems. A means Archimedean, U means ultrametric.

Class Proven Theorems Good All Bad 3,6 Difficult 1,3,4,5,6

Fast Class Good Class Difficult Class. S Slow Class Bad Class Easy Class Good Class Bad Class S

Figure 20. Proven Theorems. Various Classes

Here, the entropy α of this system of iterative functions is related to a Lyapounov exponent β. Consider the set of matrices defined in (3.8) or in (3.9), where a M −2a matrix M relative to a valuation a is chosen with probability δM := 2 , and remind the definition of the Lyapounov exponent β, 1 β := lim E [log M1 M2 . . . Mn ], n n→∞ || · · · ||

[when each matrix M is independently drawn in with probability δM ]. Then α = 8log2 2β [see [25] for a proof]. M − 3.7. Final Classification of all the Euclidean Dynamical systems. Figure 19 provides a list of all the algorithms which are studied in this paper, with their main characteristics: their type (defined by a number between 0 and 4), if they are generic or markovian, if they are pure or mixed, easy or difficult, fast or slow, EUCLIDEAN DYNAMICS 313 etc. Figure 20 shows what Theorems are valid for each Class [see Section 2.8 for a description of the main nine theorems of this paper].

4. Main results: Generic truncated trajectories. Here, we describe the sec- ond step of Dynamical Analysis, where generic trajectories are studied. Under some precise conditions, and for a set of algorithms which will be described further, we shall prove that our main parameters, the total cost Cn, or the size of continuants ℓn follow asymptotically a Gaussian law. We provide precise central limit theorems for variables Cn,ℓn, with an optimal speed of convergence. Furthermore, we give explicit formulae for the mean and the variance. Analog results can be found in [17] or [22]. However, the general framework is not exactly the same. 4.1. Generic truncated trajectories versus rational trajectories. We re- call that our final goal is to study the execution of a gcd algorithm. These executions correspond to rational trajectories (x, V x, V 2x, ...) of the Dynamical System which meet the final value η. If P (x) is the first index i for which V i(x)= η, the algorithm stops at the P (x) step, and produces a stopping trajectory (x) := (x, V x, V 2x, . . . V P (x)x). We first replace this study [rational trajectories] Vby a slightly different one, which will be easier. We recall that such a transform constitutes the Second Step in a Dynamical Analysis. We consider for x X the trajectory (x) = (x, V x, V 2x, ...), we choose some integer n, which will∈ be fixed in the wholeV Section, and we truncate [ourselves] the trajectory at the n–th step: we obtained a truncated trajectory n(x) := (x, V x, V 2x, . . . V n−1x) which depends both on n (which will be fixed) andVx (which will be chosen at random in X): more precisely, we fix a “smooth” probability mea- sure on X, we denote by E[ ] the corresponding expectation, and we wish to study the probabilistic behaviour· of these truncated trajectories. We consider that X is endowed with some probability absolutely continuous with respect to the Haar mea- sure on X. For mixed Types, we recall that the Dynamical System is probabilistic, so that the trajectories also depend on random choices. Such a truncated trajectory can be encoded as i−1 (d1(x), d2(x),...dn(x)), with di(x)= σ(V x), and it uses the inverse branch h := h h . . . h of depth n. The main [d1] ◦ [d2] ◦ ◦ [dn] observables, which are now the total cost Cn and the n-th continuant qn, are random variables defined on X, which we now describe. The total cost Cn is defined as n i−1 Cn(x) := c(di(x)), with di(x)= σ(V x). i=1 X Since the digit–cost only depends on the digit d, it depends only on the inverse branch h = h[d] which is used. Then, the cost c is also defined on the set of inverse branches, and it can be extended to a cost on the semi-group ⋆ byH additivity. The total cost can be alternatively defined as H n C (x) := c(h )= c(h h . . . h ), (4.1) n [di] [d1] ◦ [d2] ◦ ◦ [dn] i=1 X and we are interested in the asymptotic distribution of cost C (for n ). n → ∞ The truncated trajectory n(x) builds a continued fraction of depth n: It is the truncation of the continuedV fraction (of infinite depth) which corresponds to the 314 BRIGITTE VALLEE´

complete trajectory (x). It is defined by the LFT h[d1] h[d2] . . . h[dn] and the rational V ◦ ◦ ◦ pn (x) := h[d1] h[d2] . . . h[dn](0) qn ◦ ◦ ◦ is called the n–th convergent of x. The pair Qn := (pn, qn), defined as

pn 0 Qn = = M[d1] M[d2] . . . M[dn] qn · · · 1     is a random variable which is called the continuant of order n, and we wish to study its size ℓ( Qn ), where ℓ is the size, and the absolute value is defined in (1.10, 1.12). In fact, in| the| number case, we replace the binary size by the plain logarithm, and we define in all the cases ℓ := log ( Q ), n ∗ | n| where the logarithm log∗ is logq in polynomial case, and log2 in the number case. It is of great (algorithmic) interest to study the asymptotic distribution of random variable ℓn.

4.2. The Quasi-Powers Theorem. How to obtain an asymptotic Gaussian law? We consider a sequence of random variables Rn defined on the same probabilistic space, and we wish to prove that the limit law of variable Rn is the Gaussian law. To establish such an asymptotic gaussian law, it is standard to use the moment generating function, i.e., the expectation E[exp(wRn)], for w complex. In proba- bilistic i.i.d. situations, E[exp(wRn)] is the n-th power of some expectation. In our setting, and for each parameter Rn = Cn or Rn = ℓn, a quasi-powers approximation (with uniform remainder term) will be be obtained for E[exp(wRn)]. In this case, the following Quasi-Powers Theorems of Hwang [47, 48, 49] will be used and this will lead to the asymptotic gaussian law. This theorem is a compact and versatile statement, which encapsulates the consequences of the L´evy continuity theorem and the Berry-Esseen inequality.

Theorem A [Quasi-Powers Theorem.] Assume that the moment generating func- tions E[exp(wRn)] for a sequence of functions Rn are analytic in a complex neigh- borhood of w =0, and satisfy W −1 E[exp(wRn] = exp[βnU(w)+ V (w)] 1+ O(κn ) , (4.2)  with βn, κn as n , U(w), V (w) analytic on and the O–term uniform in . Then,→ the ∞ mean→ and ∞ the variance satisfy W W E[R ]= U ′(0) β + V ′(0) + O(κ−1) , V[R ]= U ′′(0) β + V ′′(0) + O(κ−1) . n · n n n · n n ′′ Furthermore, if U (0) =0, the distribution of Rn is asymptotically Gaussian, with 6 −1 −1/2 speed of convergence O(κn + βn ),

′ Y Rn(x) U (0)n 1 −y2/2 −1 −1/2 Pν x − Y = e dy + O(κn + βn ) . U ′′(0)n ≤ √2π " # Z−∞

p EUCLIDEAN DYNAMICS 315

4.3. Relating moment generating functions to n–th powers of transfer operators. We now provide an alternative expression of moment generating func- tions of our main parameters which relate them to some extensions of the density transformer.

Digit-costs. We relate this expectation E[exp(wCn)] to the n–th iterate of the operator H1,w,(c) defined in Figure 4. This weighted transfer operator H1,w,(c) will be our main tool. It is defined as a perturbation of the density transformer H1: we multiply the component operator H1,[h] by the factor exp[wc(h)]. We then obtain a weighted component operator H = δ exp[wc(h)] h′(x) f h(x) 1,w,[h],(c) h · · | | · ◦ and the “total” weighted transfer operator is defined as in (2.5) or in (2.7), H [f](x)= δ exp[wc(h)] h′(x) f h(x) (4.3) 1,w,(c) h · · | | · ◦ hX∈H for generic types. For Markovian systems [Type 2], we perform this transformation in each component of each coefficient of the matrix in (2.7). Then, additive prop- erties of costs and multiplicative properties of derivatives [or denominators] entail a nice formula for the n-th iterate of the operator H1,w,(c), for instance, n ′ H1,w,(c)[f](x)= δh exp[wc(h)] h (x) f h(x) , (4.4) n · | | · ◦ hX∈H for generic types. We now relate the expectation E[exp(wCn)] to the n–th iterate of the operator H1,w,(c). Remark that the cost Cn(x) is equal to c(h) on the “fundamental” set h(X). A fundamental set is just the image h(X) of X by an element h ⋆; When the depth of h equals n, such a set is exactly the subset of x X for which∈ H the first n digits of x are fixed and equal to digits of the rational h(η∈). Remind that a LFT h is chosen with a probability equal to ∈ H P[h is chosen] = δ f(u)du = δ h′(x) f h(x)dx. h · h | | ◦ Zh(X) ZX Then,

n E[exp(wCn)] = exp[wc(h)] P[h is chosen] = H1,w,(c)[f](x) dx (4.5) n · X hX∈H Z n For Markovian types, instead of H1,w,(c)[f](u), we have a matrix relation, of the form f [0] 1 1 Hn (u). 1,w,(c) f [1]    Continuants. The moment generating function E[exp(2wℓn)] of ℓn can be ex- pressed in terms of the n–th iterate of the operator H1,w. This operator is defined by its component operators H1,w,[h] which operate on functions F of two real vari- ables x and y as follows: H [F ](x, y)= δ1−w h′(x) h′(y) −w F (h(x),h(y)) , (4.6) 1,w,[h] h · | | · | | · Then, the total transfer operator is defined as in (2.5) [for generic types] or as in (2.7) for Markovian types. Remark that, on the diagonal x = y, one has H [F ](x, x)= δ1−w h′(x) 1−w F (h(x),h(x)). 1,w h · | | · hX∈H 316 BRIGITTE VALLEE´

Then, the operator H1,w is related to the (plain) transfer operator Hs defined in (2.5) or in (2.7), in the sense that H1,w can be viewed as an “extension” of H1−w to functions of two variables. It can be also viewed as an “extended” perturbation of H1. −2 ′ In all the cases, the relation Qn (x) = δh h (0) [which relates the point x and the inverse branch of depth n which| is relative| · to | the| beginning CFE of x] is the key for the alternative expression for the moment generating function of E[exp(2wℓn)] n as a function of H1,w,

−w ′ −w n E[exp(2wℓn)] = δh h (0) P[h is chosen] = H1,w[F ](u, 0)du, (4.7) n · | | · X hX∈H Z with F (x, y) := f(x), where f is the density chosen on X. Finally, Relations (4.7) and (4.5) show that the moment generating functions of interest are closely related to powers of transfer operators H1,w,(c) or H1,w. 4.4. Functional analysis. We first describe a set of conditions on a general opera- tor Gw, and we will prove that these conditions are sufficient to entail a quasi-power behaviour of the n–th power of this transfer operator Gw, and thus a quasi-power behaviour for related moment generating functions. Conditions (A). There exists a functional space where the following is true: F [Anw(1, 0)]. The operator Gw acts on when w is (complex) near 0 and the map w G is analytic at w =0. F 7→ w [UDE and SG]. The operator G0 : has a unique dominant eigenvalue λ =1, and a spectral gap: the rest of theF→F spectrum lies in a disk whose radius is < 1. [SLCw]. The pressure map ΛG(w) := log λG(w) has a second derivative which is not zero at w =0.

Theorem AA. Suppose that Conditions (A) hold for an operator Gw. Then the hypotheses of Theorem A [Quasi-Powers Theorem] are fulfilled for all the variables n Rn whose moment generating function is “closely” related to the n-th power Gw, applied to some function F of . F Proof. Elementary perturbation theory [53] implies that Gw inherits the dominant eigenvalue property and the spectral gap when w is near 0. This proves that the n n–th iterate Gw of the operator behaves as a uniform quasi–power where the main term involves the n–th power of the dominant eigenvalue λG(w) of the operator G , so that U(w) = log λ (w)) and β = n. Finally, the condition U ′′(0) = 0 is w G n 6 exactly Condition [SLCw]. 4.5. Generic truncated trajectories: Study of digit–costs. When the cost c is of moderate growth [i.e., c(d) is O(ℓ(d)], and the gcd algorithm is any element of the Fast Class, then Conditions (A) are fullfilled for the weighted transfer operator Gw := H1,w,(c) defined in Figure 4. These facts will be proven in Section 8, where the convenient functional space will be described. In both cases, relation (4.5)F and Theorem (AA) entail that the Quasi-Powers Theorem can be applied. This leads to an asymptotic Gaussian Law for the total cost Cn. We provide a quite precise central limit theorem for variable Cn, with an optimal speed of convergence. Furthermore, we give explicit formulae for the mean and the variance. Theorem 1. Consider any gcd algorithm which belongs to the Fast Class, together with a non constant digit cost of moderate growth. Consider any probability P on EUCLIDEAN DYNAMICS 317

X with a smooth density f with respect to the Haar measure on X. Then, there are µ(c) and ρ(c) so that∈F for any n, and any Y R ∈ Y C (x) µ(c)n 1 2 1 P x n − Y = e−y /2 dy + O . ρ(c)√n ≤ √2π √n   Z−∞  

Furthermore, if r1 is the subdominant spectral radius of the density transformer H, for any θ which satisfies r1 <θ< 1, one has : E [C ]= µ(c) n + µ (c)+ O(θn) , V [C ]= ρ2(c) n + ρ (c)+ O(θn) . n · 1 n · 1 Moreover, the constants µ(c) and ρ2(c) admit expressions which involve the pressure function Λ(1, w) := log λ(1, w) relative to the weighted transfer operator H1,w,(c) defined in (4.3),

′ ′ 2 ′′ ′′ ′2 µ(c)=Λ (1, 0) = λ (1, 0), ρ (c)=Λ 2 (1, 0) = λ 2 (1, 0) λ (1, 0). w w w w − w Finally, µ(c) involves the invariant density ψ,

µ(c)= δh c(h) ψ(t) dt . · h(X) Xh∈h Z

4.6. Generic trajectories for the Good Class: Study of continuants. For the good Euclidean dynamical systems, then Conditions (A) are fullfilled for the transfer operator Gw := H1,w defined in Figure 4. This will be proven in Section 8. Then, relation (4.7) and Theorem (AA) entail that the Quasi-Powers Theorem can be applied. This leads to an asymptotic Gaussian Law for the size of continuants ℓn. We provide a quite precise central limit theorem for variable ℓn, with an optimal speed of convergence. Furthermore, we give explicit formulae for the mean and the variance. Remark that, for algorithms of the Difficult Class, the transfer operator Gw := H1,w does not seem to satisfy Conditions (A) [see Section 8]. Finally, we have proven:

Theorem 2. Consider any gcd algorithm of the Good Class. Denote by ℓn the logarithm of the n–th continuant Qn (in the number case) or deg Qn (in the poly- nomial case). Consider any probability P on X with a smooth density f. Then, there are β and γ so that for any n, and any Y R ∈ Y 2ℓ (x) αn 1 2 1 P x n − Y = e−y /2 dy + O . γ√n ≤ √2π √n   Z−∞  

Furthermore, if r1 is the subdominant spectral radius of the density transformer H, for any θ which satisfies r1 <θ< 1, one has : α γ2 E [ℓ ]= n + α + O(θn) , V [C ]= n + γ + O(θn) . n 2 · 1 n 4 · 1 Moreover, the constants α and γ admit expressions which involve derivatives of w Λ(1 w) at w = 0, where Λ(s) := log λ(s) is the pressure function of the 7→ − weighted transfer operator Hs defined in (2.5) or in (2.7), α = Λ′(1) = λ′(1), γ2 =Λ′′(1) = λ′′(1) λ′2(1) | | − − 318 BRIGITTE VALLEE´

We recall that α is the entropy of the dynamical system and can be expressed with the invariant function ψ,

′ α = δh log δh log V (t) ψ(t)dt. − − X | | hX∈H Z

5. Back to the Euclidean Algorithms. With this Section, we begin the third step of Dynamical Analysis. As it is often the case, the discrete problem is more difficult than its continuous counterpart. An execution of a Euclidean algorithm on the input (u, v) formed with two in- tegers u, v such that u/v = x gives rise to a rational trajectory (x) which stops at the P (x)–step when it meets η, and, we work with the stoppingV trajectory (x). When we worked previously [in Section 4] with (generic) truncated trajectories,V the truncation degree n was chosen by us, and we are led to study n-th powers of trans- fer operators, with respect to the reference parameter n. For a rational trajectory (x) corresponding to an input (u, v), the truncation degree is in a sense automatic [itV is no longer chosen], and the reference parameter is now the size L(u, v) of the input (u, v). On inputs on size N, the reference probability measure PN is now the uniform discrete measure on the (finite) sets ΩN , ΩN of inputs of size N defined in (1.14). We then proceed in two steps: First, we work withe all possible inputs of Ω, which build all the rational trajectories [these which meet η]. Since we have to consider LFT’s with any depth, we wil be led to study quasi–powers of transfer operator [This first step will be performed in this Section]. Second, later on, in Sections 6 and 7, we restrict ourselves to a given size N, and we have to “extract” these particular inputs.

5.1. Parameters of interest. We now describe the new parameters of interest. First, the total cost of the trajectory, relative to a digit–cost c, is

P (u,v) u C(u, v) := c(d ( )) . (5.1) i v i=1 X

Second, we are also interested in the behaviour of the remainder pair Ui := (ui+1,ui). More precisely, we wish to study the Interrupted Algorithm which stops as soon as the absolute value of the remainder pair Ui becomes smaller than some power of the absolute value U0 of the input pair, and we are led to describe the behaviour of the continuant| at a| fraction of the depth P (u, v) [the depth P is the depth of the continued fraction or the number of iterations of the algorithm]. We consider a parameter δ [0, 1], and we define the remainder at the fraction δ as ∈ a random variable U[δ] on Ω, Ω. More generally, we wish to study the behaviour of (beginning and ending) continuants at a fraction of the depth. The definition of beginning and ending continuantse are given in Section 1. 3 [See Equations (1.6, 1.8)]. It is then natural to let, for X U,V,Q , ∈{ } X (u, v)= X (u, v), LX (u, v) := log ( X (u, v) ) (5.2) [δ] ⌊δP (u,v)⌋ [δ] ∗ | [δ] | where, as previously, log∗ is log2 in the number case or logq for polynomials in Fq[Z]. EUCLIDEAN DYNAMICS 319

Third, the bit–complexities of the (plain) algorithm (which only computes the gcd) or of the extended algorithm (which also computes the Bezout Coefficients) on an input (u, v), defined as

P (u,v) P (u,v) B(u, v) := ℓ(d ) L(U ), B(u, v) := ℓ(d ) L(Q ) (5.3) i · i i · i i=1 i=1 X X involve parameters of various types. Remark. On a coprime input (u, v), the Euclid algorithm “writes” the result u/v = h(0). We remark that the last step of a Euclid algorithm is particular [see Figure 1 for some instances]. As an example, the standard Euclidean algorithm cannot use the quotient m = 1 in its last step. Then, the LFT used by the algorithm belongs to ⋆ where is the set of LFT’s used in the last step. In fact, in this case, any rationalH ×F admitsF two CFE’s, the first one, built by the Euclid Algorithm, is the proper one: its sequence of digits ends with an element of . The second one is the improper one and does not end with an element of : it cannotF be produced by the Algorithm, but this is a possible CFE for the rationalF u/v. We consider here these two CFE’s which generate together the whole set ⋆, and we do not study exactly costs defined as in (5.1,5.2,5.3) but their “smoothedH version” which takes into account the two possible CFE’s: it is the average between the cost on the proper extension and the cost on the improper one. For all the costs R which are studied here, whose growth is at most moderate, it is clear that R R is O(1). n − n It is then sufficient to study the smoothed version, and we shall denote by SR the Dirichlet series relative to this smoothed version R. e

5.2. Relating Dirichlet series to quasi-inversese of transfer operators: Digit–cost. The fundamental fact is the existence, for all the types, of a sim- ple relation between S (2s, w) and the quasi-inverse (I H )−1 of a weighted C − s,w,(c) transfer operator Hs,w,(c) (which depends on two parameters s and w). For all types, the transfer operator Hs,w,(c) is defined via its components opera- tors [see Figure 4] H [f](x)= δs exp[wc(h)] h′(x) s f h(x) . (5.4) s,w,[h],(c) h · · | | · ◦ For any generic type, the operator Hs,w,(c) is the sum of all its component opera- tors, while, for Markovian Type 2, the extension is made, as previously, on all the components of the coefficients of the matrix defining Hs in (2.7). Note that this operator is a simultaneous extension of the three operators H1, H1,w,(c), Hs defined previously. Remark also, as previously, that the n-th iterate of this operator has a nice form; for instance, for generic types, one has

n s ′ s Hs,w,(c)[f](x)= δh exp[wc(h)] h (x) f h(x) . (5.5) n · · | | · ◦ hX∈H

Let us explain why such a relation exists between SC (s, w) and the quasi–inverse ⋆ of Hs,w. We recall that, for any (u, v) Ω, there exists a unique h for which u/v = h(η) [η is the stopping value of the∈ gcd algorithm]3. This entails∈ H a bijection

3we suppose here (for simplicity) that the initial set J and the final set F coincide with the total set H. This has been justified at the end of Section 5.1. 320 BRIGITTE VALLEE´ between the set of coprime valid inputs Ω and the semi group ⋆. Then, the sum which defines S (s, w) can be completely expressed by means ofH LFT h ⋆, C ∈ H 1 s ′ s SC (s, w) := 2s exp[wC(u, v)] = δh h (η) exp[wc(h)] (u, v) ⋆ · | | · (u,vX)∈Ω | | hX∈H

s ′ s k = δh h (η) exp[wc(h)] = Hs,w,(c)[1](η). k · | | · kX≥0 hX∈H kX≥0 Here, we used the alternative expression of (u, v) −2s given in (2.8, 2.11) and the fact that C(u, v) equals c(h), due to Equations| (5.1,| 4.1). Finally,

S (s, w) = (I H )−1[1](η). (5.6) C − s,w,(c) An analog relation holds in Markovian cases.

When derivating with respect to w Equation (5.6), one relates the generating [1] −1 function SC (s) defined in (1.20) to the quasi-inverse (I Hs) together with its (c) − weighted version Hs defined in Figure 4 via the relation

S[1](s) = (I H )−1 H(c) (I H )−1[1](η). (5.7) C − s ◦ s ◦ − s For the second moment, with a supplementary derivation, one gets

2 S[2](s) = (I H )−1 H(c ) (I H )−1[1](0)+ (5.8) C − s ◦ s ◦ − s +2(I H )−1 H(c) (I H )−1 H(c) (I H )−1[1](0). − s ◦ s ◦ − s ◦ s ◦ − s We observe that all these Dirichlet series have the same structure: quasi–inverses −1 of the form (I Hs) , and between these quasi-inverses, operators which involve − (ci) various weights, i.e., operators of the form Hs . Let us consider the weighting operator W(c) which operates on transfer operators and weights with cost c(h) each component of a transfer operator. It satisfies

i (c) ∂ i (ci) ∂ W H = H = H , W H = W i H = H = H . (c) s s ∂w s,w|w=0 (c) s (c ) s s ∂wi s,w|w=0 Furthermore, we adopt shorthand notations where we omit the quasi-inverses, the zeta function, the function 1, and the point η: we only take into account the op- erators “between” the quasi inverses. For instance, equations (5.7, 5.8) can be re-written as [here, we omit the index (c) in the operator W ]

[1] [2] 2 SC = [W ], SC = [W ]+2[W, W ].

[k] Any series SC (s) can be expressed with involved expression which contains iterates of the weighting operator W . For costs of moderate growth, we will see that the “dominant” term of the series S[k](s) is

S[k] [W, W, W, . . . , W ] (k times) (5.9) C ≍ while, for costs of large growth, the “dominant term” will be

S[k](s) [W k] (5.10) C ≍ EUCLIDEAN DYNAMICS 321

5.3. Relating Dirichlet series to quasi-inverses of transfer operators: Con- tinuants at a fraction of the depth. We study the parameters LX[δ] for X U,V,Q . As previously, we consider the Dirichlet moment generating function ∈{ } series SLX[δ] (s, w) of LX[δ], defined as 1 S (s, w) := X 2w. LX[δ] (u, v) 2s | ⌊δP (u,v)⌋| (u,vX)∈Ω | | Consider an input (u, v) of Ω on which the algorithm performs p iterations. There exists a unique LFT h of depth p such that u/v = h(η). One can decompose h in two LFT’s g and r of depth δp and p δp such that h = g r. In this case, one has ⌊ ⌋ −⌊ ⌋ ◦ δ (g r)′(η) = U −2, δ r′(η) = U −2, δ g′(0) = Q −2. g◦r · | ◦ | | 0| r · | | | i| g · | | | i| Ending continuants [X = U or X = V ]. Remark that the two variables U and V coincide on the set Ω of valid coprime inputs. The general term of the series SLU [δ] (s, w) decomposes as U 2w | i| = δ−w r′(η) −w δs (g r)′(η) s = [δs−w r′(η) s−w] [δs g′(r(η)) s]. U 2s r · | | · g◦r| ◦ | r · | | · g · | | | 0| Now, when (u, v) varies in the set of coprime inputs of Ω with a given height p, we obtain 2w Ui p−i i | | 2s = Hs−w Hs[1](η), (5.11) U0 ◦ (u,v)∈Ω | | P (u,vX)=p and finally, with all depths

S (s, w)= Hp−⌊δp⌋ H⌊δp⌋[1](0) . LU[δ]  s−w ◦ s  Xp≥0   Now, if δ is a rational of the form δ = c/(c + d), then

c+d−1 S (s, w)= Hj−⌊δj⌋ Hdk Hck H⌊δj⌋[1](0). (5.12) LU[δ] s−w ◦  s−w ◦ s  ◦ s j=0 X kX≥0   The central part of the previous formula defines the so–called pseudo–quasi-inverse Hs,w, namely H := Hdk Hck. (5.13) s,w s−w ◦ s kX≥0 Of course, since Hs and Hs,w do not commute, this is not a “true” quasi-inverse. However, we study this operator when w is near to 0, and we can hope that the properties of Hs,w will be close to properties of a true quasi-inverse. We see that this is true in Section 7.

Beginning continuants [X = Q]. The general term of the series SLQ[δ] (s, w) decom- poses as Q 2w | i| = δ−w g′(0) −w δs (g r)′(η) s = [δs−w g′(0) −w g′(r(η)) s] [δs r′(η) s]. U 2s g ·| | · g◦r| ◦ | g ·| | ·| | · r ·| | | 0| 322 BRIGITTE VALLEE´

Now, when (u, v) varies in the set of all inputs of Ω with a given height p, we obtain

2w Qi p−i i | | 2s = Hs Hs,w[1](η, 0), (5.14) U0 ◦ (u,vX)∈Ω | | P (u,v)=p b where the (new) operator Hs is defined via its components Hs,[h] in Figure 4. We consider, as previously, an integer i of the form i = δP , with a rational δ [0, 1] ⌊ ⌋ ∈ of the form δ = c/(c + d). Thus,b P = (c + d)k + j, with j

c+d−1 S (s, w)= Hj−⌊δj⌋ Hdk Hck H⌊δj⌋[1](η, 0). (5.15) LQ[δ] s ◦  s ◦ s,w ◦ s,w j=0 X kX≥0 In the same vein as previously,b for the endingb coontinuants, there appears a pseudo- quasi-inverse Hs,w, defined as H := Hdk Hck, b s,w s−w ◦ s kX≥0 which can be expected to beb close to a trueb quasi-inverse. 5.4. Relating Dirichlet series to quasi-inverses of transfer operators: Bit– complexity. The bit-complexity is more involved to study . . . and was studied for the first time in [2], then in [108]. Remember that it is defined via costs B, B [See (5.3)]. Here, we only obtain an alternative expression for the Dirichlet expectation series R(u, v) S[i](s) := R (u, v) 2s (u,vX)∈Ω | | when R is equal to B or B and i =1, 2. We first deal with the elementary costs ℓ(m ) U w, ℓ(m ) Q w, i · | i| i · | i| for some (small) w and fixed index i with 1 i p. The corresponding Dirichlet generating functions are obtained by an easy modification≤ ≤ of series involved in (5.11) or (5.14), namely Hp−i H(ℓ) Hi−1[1](η), Hp−i−1 H(ℓ) Hi [1](η, 0), s−w ◦ s ◦ s s ◦ s ◦ s,w Xp≥i Xp≥i (ℓ) (ℓ) b b where the operators Hs , Hs are defined as in Figure 4, with an associated digit- cost c := ℓ, the binary length of an integer. Now, the generating Dirichlet series of B and B are just obtainedb with taking the sum over all the indices i between 1 and p, and taking the derivative with respect to w (at w = 0). We obtain, after the first step [i.e., taking the sum over indices i] (I H )−1 H(ℓ) (I H )−1[1](η), (I H )−1 H(ℓ) (I H )−1[1](η, 0), − s−w ◦ s ◦ − s − s ◦ s ◦ − s,w and, after the second step, b b S[1](s) = (I H )−1 ∆H (I H )−1 H(ℓ) (I H )−1[1](η) (5.16) B − s ◦ s ◦ − s ◦ s ◦ − s

S[1](s) = (I H )−1 H(ℓ) (I H )−1 ∆H (I H )−1[1](η, 0). (5.17) B − s ◦ s ◦ − s ◦ s ◦ − s b b EUCLIDEAN DYNAMICS 323

Let us consider the derivation operator (with respect to s), denoted by ∆, which operates on transfer operators and use the similar shorthand notations as in Section 5.2, with omitting the index ℓ in the weighting operator W . Then, we have, for [1] instance, SB = [∆, W ]. For the moment of order 2, we first deal with the elementary costs

ℓ(m ) ℓ(m ) U w U t, ℓ(m ) ℓ(m ) Q w Q t, i · j · | i| · | j | i · j · | i| · | j | for some (small) w,t and fixed index i, j with 1 i, j p, and it is easy to obtain an alternative expression for the corresponding Dirichlet≤ ≤ series, at least for the ending continuants. If we are only interested by the “dominant” terms, i.e., the terms which bring at least four quasi–inverses, we have 1 S[2] 2[∆, ∆, W, W ] + [∆, W, ∆, W ] + [∆2, W, W ] + [∆, ∆W, W ] + [∆, ∆, W 2]. 2 B ≍

6. Average–case analysis of Euclidean Algorithms. Here we perform an average–case analysis, and we wish to obtain the asymptotic behaviour of the mean EN [R] of our main parameters, and more generally some hints on the moments k EN [R ] of order k. Our strategy is as follows. We have obtained alternative ex- [k] pressions of SR(s, w) [from which we can obtain expressions for SR (s) by taking [k] derivatives with respect to w at w = 0], or directly expressions for SR (s). The [k] series SR (s) are Dirichlet generating series, and they gather all the input data (u, v) Ω marked with their size. We now “extract” coefficients of these Dirichlet ∈ series in order to obtain probabilistic behaviours on ΩN .

6.1. Particularities of the polynomial case. In this case, both size and topol- ogy are ultrametric. The series SR(s, w) is a power series with respect to w and −2s [k] z = q [denoted by TR(z, w)], and the series SR (s) is a power series with respect −2s [k] to z = q , denoted by TR (z),

L(u,v) [k] L(u,v) k TR(z, w) := z exp[wR(u, v)],TR (z)= z R (u, v). (u,vX)∈Ω (u,vX)∈Ω If we denote by [zn]A(z) the coefficient of zn inside the power series A(z), the k moment EN [R ] of order k, or the moment generating function EN [wR] are defined by [zN ]T (z, w) [zN ]T [k](z) E R E k R N [exp(wR)] = N , N [R ]= N , [z ]TR(z, 0) [z ]TR(z, 0) and are easily extracted by methods of analytic combinatorics [33][34]. This study of Euclidean Algorithms on polynomials can be entirely done with classical generating functions, at least when a uniform probability is chosen on ΩN . This is due to the fact that, for Type 0, both the topology and the size are ultrametric. Since all the analyses deal with power series, the extraction is simpler and can be done more precisely than in our general framework, where we deal with Dirichlet series. See [38, 57] for instance. 324 BRIGITTE VALLEE´

[k] 6.2. Coming back to the number case. In the number case, the series SR (s) are Dirichlet series which can be written as Rk(u, v) R[k] S[k](s)= = n with R[k] = Rk(u, v), R (u, v) 2s ns n (u,v)∈Ω | | n≥1 (u,v)∈Ω, X X |(u,vX)|2 =n We wish to evaluate 2N 2 [k] k n=22N−1 φ (n) EN [R ]= 2N , (6.1) 2 [0] Pn=22N−1 φ (n) [k] where, as in Section 1.7, φ (n) are theP coefficients of the Dirichlet series Rk(u, v) S[k](s)= . R (u, v) 2s (u,vX)∈Ω | | [0] Remark that, in all the cases, the series SR (s) are related to ζ functions associated to valid inputs of the algorithm. It is then sufficient to obtain an asymptotic behaviour for the sum of coefficients of a Dirichlet series. This is why the following Tauberian Theorem [27] [99] will be an essential tool in this Section. Theorem B. [Tauberian Theorem]. [Delange] Let F (s) be a Dirichlet series with non negative coefficients such that F (s) converges for (s) >σ> 0. Assume that (i) F (s) is analytic on (s)= σ, s = σ, and ℜ (ii) for some γ 0, oneℜ has F (s6 ) = A(s)(s σ)−γ−1 + C(s), where A, C are analytic at σ, with≥ A(σ) =0. − Then, as K , 6 → ∞ A(σ) a = Kσ logγ K [1 + ǫ(K) ], ǫ(K) 0. n σΓ(γ + 1) → nX≤K

We will see that such a Theorem will be easy to use in our framework. In particular, k the sums which appear in the numerator and denominator of EN [R ] [see (6.1)] can be easily evaluated with this Theorem, via the estimates 22N 2Nσ γ an = C(σ, γ) 2 N [1 + ǫ(N) ], ǫ(N) 0, 2N−1 · · → n=2X A(σ) with C(σ, γ) := (1 2−σ) (2 log 2)γ. σΓ(γ + 1) − However, the Tauberian Theorem does not provide any remainder term, and this is why it will be no longer useful for distributional analyses. This is also a main difference with the study of the polynomial case, where use of power series easily allows to obtain remainder terms. 6.3. Functional analysis. We first describe a set of conditions, and we will prove that these conditions are sufficient to entail that hypotheses of Tauberian Theorem are valid.

Conditions (B). There exists a functional space where some operator Gs satisfies the following: F

[Ans(s, 0)]. The operator Gs acts on when s satisfies s > σ with σ < 1 and the map s G is analytic on s > σ. F ℜ 7→ s ℜ EUCLIDEAN DYNAMICS 325

[UDE and SG]. The density transformer G := G1 has a unique dominant eigenvalue λ =1, and a spectral gap: the rest of the spectrum lies in a disk of radius < 1. [SM]. The spectral radius R(s) of Gs is strictly less than 1 on s = 1, except at s =1. ℜ

Theorem BB. Suppose that Conditions (B) hold for a transfer operator Gs. Denote by the set of operators A that act on transfer operators, and for which the operatorAAG acts on the Banach space L1(I). Then the hypotheses of Theorem B [Tauberian Theorem] are fulfilled for all the Dirichlet Series F (s) denoted by an expression [A1, A2,...Ak] where each Ai belongs to . More precisely, F (s) has a pˆole of order k +1 at s =1, and it admits, at s =1,A an expansion of the form a a F (s)= 0 + 1 + .... (s 1)k+1 (s 1)k − − Moreover, the “dominant” coefficient a0 can be expressed as k 1 1 a = I[A G] where I[H] := H[ψ](t)dt (6.2) 0 log2 · λ′(1)k+1 · i i=1 I Y Z involves the dominant eigenfunction ψ of the operator G and λ′(1) is the derivative of the dominant eigenvalue λ(s) at s =1. Then, the dominant constant a depends only on the subset A , A ,...A and 0 { 1 2 k} does not depend on the order of the sequence (A1, A2,...,Ak). Moreover, if Gs,w is a weighted transfer operator relative to a dynamical system (X, V ) and a digit-cost of moderate growth, the integrals I[AG], for A := W[c] or A := ∆, admit alternative expressions

′ ′ I[∆G]= ∆G[ψ](t)dt = λs(1, 0), I[W[c]G]= c(h) ψ(t)dt = λw(1, 0), X · h(X) Z hX∈H Z which involve the derivatives of the dominant eigenvalue λ(s, w) at (1, 0). [We have already considered such expressions in Equations (2.15, 2.16)].

Proof. Elementary perturbation theory [53] implies that Gs inherits the dominant eigenvalue property and the spectral gap when s is (complex) near 1, so that Gs decomposes as G = λ(s) P +N , where λ(s) is the dominant eigenvalue of G , P s · s s s s is the projection on the dominant eigensubspace, and Ns is the operator relative to the remainder of the spectrum. The previous decomposition extends to any power Gn = λ(s)n P + Nn, and to the quasi–inverse s · s s P (I G )−1 = λ(s) s + (I N )−1. − s 1 λ(s) − s − Since G1 has a dominant eigenvalue equal to 1, its dominant eigenfunction is the invariant density denoted by ψ. Finally, for any strictly positive function f, one has 1 (I G )−1[f](x) − ψ(x) f(t)dt when s 1. − s ∼ λ′(1) · → ZX Finally, hypothesis (ii) of Tauberian Theorem is satisfied at s = 1 for any Dirichlet series of the form [A1, A2,...Ak] with γ = k, and the dominant constant a0 has the described form. On the other side, Condition SM proves that hypothesis (i) of Tauberian Theorem is satisfied. 326 BRIGITTE VALLEE´

6.4. Number of steps. [105, 106, 107, 108]. For algorithms of the Fast Class [we recall that the Fast Class is the union of the Good Class and the Difficult Class], the operator Hs satisfies Conditions (B). [See Section 8]. Then, Relation (5.7) applied to the particular case c = 1, S[1](s) = (I H )−1 H (I H )−1[1](η) − s ◦ s ◦ − s entails that Tauberian Theorem can be applied at s = 1 with an exponent γ = 1 for the expectation EN [P ]. More generally, Relation (5.9) entails that Tauberian k Theorem can be applied at s = 1 and γ = k for the moment EN [P ] of order k. Theorem (BB) proves that the moment of order k is asymptotic to the k-th power of the mean value. In particular, the variance is of order o(N).

For algorithms of the Bad Class, the transfer operator Hs of the induced dy- namical system [see Section 2.6] satisfies Conditions (B) [see Section 8 for a proof]. (c0) The operator Hs can be viewed as the operator Hs relativee to the cost c0(d)= d. Since c0 is a cost of large growth, Hs brings a supplementary pˆole of order 1 at s = 1. Then, Relation (5.7) applied to this particulare case

S[1](s) = (I H )−1 H(c0) (I H )−1[1](η) − s ◦ s ◦ − s entails that Tauberian Theorem can be applied at s = 1 with an exponent γ = 2 e e e k for the expectation EN [P ]. Now, for the moment EN [P ] of order k, the operator k (c0 ) Hs has a dominant pˆole at s = k. Then, Relation (5.10) shows that the moment k EN [P ] of order k is of exponential order. e Theorem 3. [Number of steps.] For any algorithm of the Fast Class, the expecta- tion EN [P ] of the number P of steps on the valid inputs of size N is asymptotically linear with respect to size N, 2log2 E [P ] µ N, where µ := N ∼ · α where α is the entropy of the dynamical system. The standard deviation is o(N), b b and, consequently the random variable P satisfies the concentration of distribution property. Any Euclidean Algorithm associated to a dynamical system of the Bad Class per- forms an average number of steps on valid rationals of size N that is quadratic with respect to size N, 2 log 2 2 EN [P ] N , ∼ ζ(2) where ζ(s) is the Zeta function relative to valid inputs. For any integer k 2, the k–th moment of total number of steps is of exponential type ≥ k N(k−1) EN [P ] = Θ[2 ]. In particular the standard deviation is Θ(2N/2).

6.5. Digit–costs of moderate growth. [108] For algorithms of the Fast Class, the operator Hs satisfies Conditions (B). Moreover, for a cost c of moderate growth, (c) the operator Hs defined in Figure 4 is analytic on s 1.[see Section 8] ℜ ≥ Theorem 4. [Total cost.] Consider any algorithm of the Fast Class, together with a cost c of moderate growth. The expectation EN [C] of the total cost C on EUCLIDEAN DYNAMICS 327 the valid inputs of sire N is asymptotically linear with respect to size N, 2log2 E [C] µ(c) N, with µ(c) := µ(c), E [Ck] (E [C])k N ∼ · α · N ∼ N where α is the entropy of the dynamical system, and µ(c) the average value of cost b b c with respect to the density defined by the invariant function ψ [see (2.15, 2.16)]. The standard deviation is o(N), and, consequently the random variable expressing the total cost C satisfies the concentration of distribution property. It is possible to obtain a more general theorem for costs of large growth and/or algorithms of Bad Class. (See [108]). Remark. Comparing Theorems 1, 3 and 4 shows that, for any algorithm of the Fast class, and any cost c of moderate growth, one has µ(c)= µ µ(c), so that · EN [C] E[Cn] EN [C] µ(c) EN [P ], b .b (6.3) ∼ · EN [P ] ∼ n This proves that executions of Euclidean Algorithms [which correspond to rational trajectories] in the Fast Class behave on average similarly to the way truncated real trajectories behave on average.

6.6. Continuants at a fraction of the depth. Here, our starting point are Relations (5.12, 5.15). For X U,V,Q , the Dirichlet series S[1] (s) is obtained ∈{ } LX[δ] by taking the derivative (with respect to w) of S (s, w) at w = 0. For X LX[δ] ∈ U, V , and for Algorithms of the Fast Class, it has a dominant pole at s = 1 of order{ } 2. Then, Tauberian Theorem can be applied at s = 1 with γ = 1. The series S[k] (s) relative to moments of order k has a dominant pole at s = 1 of order k +1. LU[δ] This analysis appears under a different form in [24]. For X = Q, the situation is more involved. For algorithms of the Good Class, the operator Hs has good dominant spectral properties, closely related to these of the operator Hs; this is due, in particular, to the property (P 2) of Figure 2, which was called “Bounded Distortion Property” . Then, the analyses for the beginning and ending continuants are similar. For the algorithms of the Difficult Class, the behaviour of the operator Hs may be quite involved, and the behaviour of the beginning continuants is more difficult to study. It is not the same a priori as for the ending continuants. Theorem 5. For any algorithm of the Fast Class, the expectation of the size of the (ending) continuant at a fraction δ on the set of valid inputs with size N is asymptotically of the form E [LU ] (1 δ) N. N [δ] ∼ − · The standard deviation is o(N). Consequently the random variable LU[δ] satisfies the concentration of distribution property. For any algorithm of the Good Class, the expectation of the size of the (begin- ning) continuant at a fraction δ on the set of valid inputs with size N is asymptot- ically of the form E [LQ ] δ N. N [δ] ∼ · The standard deviation is o(N). Consequently the random variable ℓ[δ] satisfies the concentration of distribution property. 328 BRIGITTE VALLEE´

Remark. Comparing Theorems 2, 3 and 5 shows that, for any algorithm of the Good Class, the behaviour of beginning continuants is the same [on average] for rationals and for reals, one has

α EN [LQ[δ]] E[ℓn] EN [LQ[δ]] EN [δP ], . (6.4) ∼ 2 · EN [δP ] ∼ n

6.7. Bit–complexity. Here, our starting point are Relations (5.16, 5.17). For algorithms of the Fast Class, the operator Hs satisfies Conditions (B). Moreover, (ℓ) since the size–cost ℓ is of moderate growth, the operator Hs defined in Figure 4 is analytic on s 1. Then Tauberian Theorem can be applied to Dirichlet series [1] ℜ ≥ SB (s), at s = 1 and γ = 2. This analysis can be found in [2], [108]. Theorem (BB) also proves that the moment of order two is asymptotic to the square of the mean. For the Bad Class, the induced system satisfies Condition (B), while the operator (ℓ) Hs brings a supplementary pole at s = 1. See [108] for more details. Theorem 6. For any algorithm of the Fast Class, the average bit-complexity of the algorithm on the set of valid inputs with size N is asymptotically of quadratic order log2 E [B] µ(ℓ) N 2, E [B2] (E [B])2 . N ∼ α · · N ∼ N Here α is the entropy of the dynamical system relative to the algorithm and µ(ℓ) denotes the average value of digit–size ℓ defined in (2.16). The standard devia- tion is o(N 4). Consequently the random variables B satisfy the concentration of distribution property. For any algorithm of the Good Class, the same is true for the variable B. For any Algorithm of the Bad Class, the average bit-complexity on the set of valid inputs with size N is asymptotically of order three E [B] E [B]=Θ(N 3) N ∼ N For any integer k 2, the k–th moment of bit–complexity is of exponential type. ≥

7. Main results: Distribution Analysis of Euclidean Algorithms of the Good Class. The previous dynamical approach exhibits two main facts for algo- rithms of the Good Class. (i) First, the various parameters of interest –additive costs, size of continuants at a fraction of the depth, bit complexity– satisfy the concentration property, i.e., k k 2 EN [R ] (EN [R]) . Then, we already know that the variance VN [R] is o(EN [R ]). However,∼ since Tauberian Theorems do not provide remainder terms, we did not obtain a precise asymptotic behaviour for the variance. Now, we are interested in obtaining such a result for all our parameters of interest. (ii) Second, truncated real trajectories exhibit Gaussian behaviour [Section 4] and executions of Euclidean Algorithms [which correspond to rational trajectories] in the Fast Class behave on average similarly to the way truncated real trajectories behave on average. [See remarks at the end of Sections 6.5 and 6.6, together with Equations (6.3,6.4)]. It is then natural to ask whether this analogy extends to distributions: Is it true that the distribution of the total cost C(u, v) on an input (u, v) of size N is asymptotically Gaussian (when N tends to )? Is it true that ∞ the size LU[δ] of the ending continuant at a fraction of the depth of a input (u, v) EUCLIDEAN DYNAMICS 329 of size N is asymptotically Gaussian (when N tends to )? Is it true that the bit- complexity follows an asymptotic gaussian law? How to∞ compare the distribution of some parameter R on truncated real trajectories and on rational trajectories? We will provide a precise answer to all these questions for all the algorithms of the Good Class and our three parameters of interest, the total cost relative to a digit– cost of moderate growth, the size of the ending continuant U at a fraction δ of the depth, the bit–complexity. These results appeared in [7][5] for the total cost C and Good algorithms of Type 1. They are generalized here to all the Algorithms of the Good Class [even those of Type 2]. Results about continuants and bit–complexity can be found in [69]. Note that the distributional analysis in polynomial case is relatively easy to deal with: Since we work with powers series, Cauchy Formula is used on compact domains instead of [not compact] strips, and uniformity estimates are easier to obtain [see [57]].

Our method is not the same for the three parameters. For R = C and R = LU[δ], we use a dynamical approach. In the study of bit-complexity, we adopt an indirect approach, where we apply the previous results. + + We first work in ΩN ,ΩN defined as

+ + ΩNe:= ΩM , ΩN := ΩM , M[≤N M[≤N e e Ω+ := (u, v) Ω ; L(u, v) N , Ω+ := (u, v) Ω ; L(u, v) N . N { ∈ ≤ } N { ∈ ≤ } For the first two parameters, we perform a distributional analysis, and our strategy consists to mainly use the two expressions thate relate the Dierichlet moment gener- ating series SC(s, w) or SLU[δ] (s, w) to the operators Hs,w, Hs−w [See (5.6, 5.12]. and we recall that, for a general cost R, coefficients of series SR(s, w) are closely + related to the moment generating functions EN [exp(wR)] + + Φw(N) EN [exp(wR)] := + , (7.1) Φ0 (N) where Φ+(N) is the cumulative value of exp(wR) onΩ+ , i.e., Φ+(N)= Ω+ , and w N 0 | N | + Φw(N) := exp[wR(u, v)] = exp[wR(u, v)]. (7.2) (u,v)∈Ω+ (u,v)∈Ω X N L(u,vX)≤N If we succeed in expressing these MGF’s as uniform quasi-powers, we can apply the Quasi-Powers Theorem [our Theorem A of Section 4] and obtain a limit gaussian law. + k If we only wish to obtain a precise information on EN [R ], we recall that Φ+ (N) + k [k] EN [R ] := + , (7.3) Φ[0](N)

+ k + where Φ[k](N) is the cumulative value of R on ΩN ,

Φ+ (N) := Rk(u, v)= Rk(u, v) , Φ+ (N)= Ω+ . (7.4) [k] [0] | N | (u,v)∈Ω+ (u,v)∈Ω X N L(u,vX)≤N 330 BRIGITTE VALLEE´

7.1. Perron’s Formula. Tauberian theorems are now insufficient for extracting coefficients from a Dirichlet series, since they do not provide remainder terms. We need a more precise “extractor” of coefficients, and the Perron formula [of order 2] is well-suited to this purpose. The Perron Formula of order two (see [31]) is valid for a Dirichlet series F (s)= a n−s and a vertical line s = D > 0 inside the n≥1 n ℜ domain of convergence of F . P 1 D+i∞ T s+1 Ψ(T ) := an(T n)= F (s) ds , − 2iπ D−i∞ s(s + 1) nX≤T Z Distributional analysis. Applying it to the Dirichlet series S(s, w) = n φw(n) n−s, we find · P 1 D+i∞ T 2s+1 Ψw(T ) := φw(n) (T n)= S(2s, w) ds . (7.5) · − 2iπ D−i∞ s(s + 1) nX≤T Z N Thus, Perron’s formula gives us information on Ψw(2 ), which is just a Cesaro sum + of the Φw(Q) [defined in (7.2)] N + Ψw(2 )= φw(n)= Φw(Q) . Q

– In the case of a digit cost of moderate cost, there is a unique value σ(w)= σC (w) of s near 1 for which the dominant eigenvalue λ(s, w) of Hs,w equals 1.

– In the case of ending continuants, there is a unique value σLU[δ] (w) of s near 1 for which the dominant eigenvalue λ(s) of H satisfies λ(s w)dλ(s)c = 1. s − These assertions are clear consequences of the Implicit Function Theorem [see Property 7 of Section 8.5] which defines an analytic function σR(w) near 0 which satisfies σR(0) = 1. It is next natural to modify the integration contour s = D into a contour ℜ containing σR(w) as a unique pole of SR(2s, w). and it is thus useful to know that the following Properties US [Uniform Estimates on Strips] hold. In fact, we consider two properties US, the first one US(s) is adapted for univariate Dirichlet series, whereas the second property US(s, w) is convenient for bivariate series S(s, w). Property US(s) There is α> 0 for which the following is true: EUCLIDEAN DYNAMICS 331

(i) S(s) admits s = 1 as a unique pole in the strip s 1 α. (ii) On the left vertical line s = 1 α, the Dirichlet|ℜ − series|≤ S(s)) is O( s ξ), with a small ξ, ℜ − |ℑ | Property US(s, w) There is α > 0 and a neighborhood of 0 for which the following is true: W

(i) for all w , SR(s, w) admits s = σR(w) as a unique pole in the strip s 1 ∈α. W |ℜ − |≤ ξ (ii) On the left vertical line s =1 α, the Dirichlet series SR(s, w) is O( s ), with a small ξ, and a uniformℜ O−-term (with respect to w). |ℑ | With the US(s) Property, it is possible to control the integral (7.6) on the left vertical line s =1 α, and spectral properties of Hs inherited from H1 give the ℜ − N desired expansion for Ψ[k](2 ). With US(s, w) Property, it is possible to control the integral (7.5) on the left vertical line s = 1 α, and spectral properties of Hs,w or Hs−w inherited from ℜ − N H1 give the desired uniform quasi-power expansion for Ψw(2 ). It is important to remark that the first assertion of Condition US(s) does not always hold, even in simpler cases, when the series S(s) is just the quasi inverse −1 (I Hs) [1](η). Consider now the case of a dynamical system of the unit interval [0,−1] with two affine complete branches of respective slopes p and q [p + q = 1]. There are two cases: −1 (a) if log p/ log q Q, then there are infinitely many poles of (I Hs) on the line s = 1, and this∈ set of poles is of the form 1+ iZa for some− non zero real numberℜ a. −1 (b) if log p/ log q Q, there is a unique pole of (I Hs) on the line s = 1, at s = 1. However, there6∈ is an accumulation of poles on− the left of the line ℜs = 1. Then Condition US (s) is never satisfied for Complete Dynamical Systemsℜ with two affine branches. On the otherhand, the second assertion of Condition US(s) is often very difficult to obtain; such a property for the Riemann ζ function is closely related to the Prime Numbers Theorem (see [31]).

7.3. UNI Conditions. If we wish Conditions US to be true, we have then to ex- clude dynamical systems with affine branches, or systems which are “like” dynami- cal systems with affine branches. This is why Dolgopyat introduces a “distance” ∆ between two inverse branches h et k of same depth, ′ ′ h (x)] ∆(h, k) = inf Ψh,k(x) , with Ψh,k(x) = log | (7.7) x∈I | | k′(x) | | and he asks this distance not to behave as in dynamical systems which are 2 conjugated to a system with affine branches. What kind of properties does thisC distance ∆(h, k) satisfy in the case of a system which is 2 conjugated to a system with affine branches? In this case, there exists f > 0 of classC 1 such that, for any n, and for any h n, there is a constant d(h) for which h′(xC) f h(x)= d(h)f(x) ∈ H | | ◦ for any x X. Then, taking the logarithm, differentiating, and putting f := log f, we get ∈ Ψ′ (x)= h′(x) f ′ h(x) k′(x) f ′ k(x). b h,k · ◦ − · ◦ Then, there exists A> 0, for which ∆(h, k) satisfies b b ∆(h, k) Aρn, n, h n, k n, ≤ ∀ ∀ ∈ H ∀ ∈ H 332 BRIGITTE VALLEE´ where ρ is the contraction ratio defined in Figure 8 which satisfies ρ< 1 for all the algorithms of the Good Class [see Property (P 1) of Section 2.5]. Conditions UNI [introduced by Dolgopyat] express that the behaviour of the distance ∆(h, k) must be not the same as for systems (X, V ) which are 2 conjugated to systems with affine branches: the inverse branches of the DynamicalC system are required to have not all “the same form”, [i.e., their derivatives must be “not too often too close” (with respect to ∆)]. There are two different conditions UNI, the Weak Condition UNI, and the strong Condition UNI.

Weak Condition UNI. There exists some η > 0 and an integer n0 such that, for any integer n n , there are two elements h, k n for which ∆(h, k) η. ≥ 0 ∈ H ≥ Strong Condition UNI. For any a, 0 0, we denote by J(h, η) the union of the fundamental intervals k( H), where k n ranges over the ∆-ball of center h and radius η, I ∈ H J(h, η) := k( ), n I k∈H ,[∆(h,k)≤η Condition UNI expresses that, for any a, 0

7.4. UNI Conditions imply US Property. First, we have previously seen that a system which satisfies Condition UNI is not 2 conjugated to a dynamical system with affine branches. In fact, Dolgopyat [29]C proved that the UNI Condition is sufficient to also imply that the quasi-inverse of the transfer operator satisfies US(s) –at least, in the case of one–variable transfer operators Hs which are related to dynamical systems with a finite number of branches. Then, Baladi and Vall´ee have adapted and generalized Dolgopyat’s result. In fact, there are two different results. The first result [7, 5] shows that the Strong Condition UNI implies the US(s, w) Property for the quasi–inverse of the transfer operator, even for dynamical systems with an infinite number of branches, and for weighted transfer operators relative to costs of moderate growth. The second result [6], whose proof is more involved and less natural, shows that the Weak Condition UNI implies the US(s) Property for the quasi–inverse of the transfer operator, even for dynamical systems with an infinite number of branches. It can be generalized in order to prove that Weak Condition UNI also implies the US(s, w) Condition for weighted transfer operators relative to costs of moderate growth. These various proofs are closely based on estimates on the following type which generalize analogue bounds due to Dolgopyat: Theorem. [Dolgopyat-type estimates]. Consider a Good Euclidean Dynamical System, with contraction ratio ρ, and let Hs, Hs,w be its transfer operator and its weighted transfer operator [relative to a cost of moderate growth]. For any ξ > 0, there is a real neighborhood Σ W of (1, 0), and there are two constants M > 0 1 × 1 EUCLIDEAN DYNAMICS 333 and γ < 1, such that, for all n 1, for all s = σ+it, w = ν+iτ with (σ, ν) Σ1 W1 and t 1/ρ2, ≥ ∈ × | |≥ Hn M t ξ γn, Hn M t ξ γn. (7.8) || s−w||1,t ≤ · | | · || s,w||1,t ≤ · | | · [Here the norm . is defined by f := sup f + (1/t) sup f ′ . || ||1,t || ||1,t | | | | A work in progress (by Lhote and Vall´ee) seems to prove that (7.8) also holds for the underlined operator Hs,w (in the case of the Good Class), with a norm 1,t adapted to functions F of two variables. || · ||

7.5. Applying Perron’s Formula [distributional analysis]. Perron’s Formula (7.5) combined with fundamental relations (5.6, 5.12, 5.15), together with Property + US(s, w) will provide the following estimate for the Cesaro sum Ψw of Φw, as T , → ∞

ER(w) 2σR(w)+1 −2τ Ψw(T ) := cn(w)(T n)= T [1+O(T )] , (7.9) − σR(w)(2σR(w)+1) nX≤T where ER(w) is the residue of SR(s, w) at the pole s = σR(w), τ is some positive constant, and the O–term is uniform on when T . Note that σR and ER are analytic on a complex neighborhood ofWw = 0. → ∞

7.6. Asymptotic normality and Quasi-Power estimates. It does not seem + easy to transfer the information (7.9) on Ψw(T ) to estimates on Φw(T ); we proceed in three steps to prove asymptotic normality of parameter R for R = C or R = LX[δ]: First Step. We introduced a smoothed model: we associate to function ǫ(T ) = −2τ + + T the probabilistic models (ΩN (ǫ), PN (ǫ)) as follows: For any integer N, set + + ΩN (ǫ)=ΩN ; next, choose uniformly an integer Q between N Nǫ(N) and N, + −⌊ ⌋ and draw uniformly an element (u, v) ofΩQ. Slightly abusing language, we refer to + + the function R in the model (ΩN (ǫ), PN (ǫ)) as the “smoothed parameter”. Now, we appeal to a classical result that is often used in number theory contexts, and we then deduce from (7.9) the following quasi-power estimates for the moment generating function of the “smoothed” version of the parameter R, + E [exp(wR)] E (w) N = exp 2 log 2[σ (w) σ (0)]N + log R , (7.10) [1 + O(2−τN )] R − R E (0)σ (w)  R R  where the O-term is uniform in w. Second Step. Now, we are again in the framework of Theorem A of Section 4 [the Quasi-Powers Theorem] , and we get that the smoothed version of cost R follows an asymptotic Gaussian distribution, with a speed of convergence in O(1/√N), together with precise informations about the asymptotic behavior of the expectation + + EN [R] and the variance VN [R]. The function U(w) of the Quasi-Powers Theorem [See Section 3] is U(w) = 2log2[σ (w) σ (0)] R − R and the constants of the expectation and variance involve the first two derivatives of U which can be computed with the Implicit function Theorem and the definition of σR. [See the beginning of Section 6.2]. 334 BRIGITTE VALLEE´

+ + Third Step. We prove that the distributions of R on ΩN (ǫ) and on ΩN are ǫ(N)– close, i.e., + P+ (u, v) P (u, v) = O(ǫ(N)) | N − N | so that the distribution of R on ΩN is also asymptotically Gaussian, with a speed of convergence in O(1/√N). The closeness of distributions, together with the worst– case polynomial complexity of the algorithms of Good Class also provides precise + information about the asymptotic behavior of the expectation EN [R] and the vari- + ance VN [R]. Finally, it is possible to return in (ΩN , PN ). 7.7. Distributional analysis of total cost. The first result of this Section proves that, for any algorithm of the Good Class, and any digit–cost of moderate growth, the total cost on ΩN follows an asymptotic Gaussian, with an optimal speed of convergence. [See [7] or [5]] Theorem 7. [Central Limit Theorem for total cost.] For a Euclidean algorithm of the Good Class, and any cost c of moderate growth, (a) The distribution of the total cost C on ΩN is asymptotically Gaussian, with speed of convergence O(1/√N), i.e., there exist two constants µ(c) > 0 and ρ(c) > 0 such that, for any N, and any y R ∈ y C(u, v) µ(c)N 1 −x2/2 b 1 b PN (u, v); − y = e dx + O . ρ(c)√N ≤ √2π √N   Z−∞   (b) The mean and the varianceb satisfy b −Nτ 2 −Nτ EN [C]= µ(c)N + µ1(c)+ O(2 ), VN [C]= ρ (c)N + ρ1(c)+ O(2 ), where τ is a strictly positive constant that does not depend on cost c. (c) Let Λ(s)b denoteb the pressure function. In theb special caseb c 1, denoting µ := µ(1), ρ2 := ρ2(1), we have ≡ 2log2 2log2 Λ′′(1) µ = = > 0, ρ2 = 2log2 | | > 0 . b b b b Λ′(1) α Λ′(1)3 | | | | In the general case,b b µ(c)= µ µ(c) , ρ2(c)= µ2(c) ρ2 + µ ρ2(c)+ µ2 µ(c) χ(c) > 0 , · · · · · 2 ′′ where µ(c) > 0 and ρ (c) 0 are given in Theorem 1, and χ(c)=Λsw(1, 0). b b ≥b b b b Claims (a), (b), and (c) also hold for PN on ΩN . 7.8. Distributional analysis of continuants. The second result of this Section + e e proves that, on ΩN , for any algorithm of the Good Class, the sizes of ending contin- uants at a fraction of the depth follow an asymptotic Gaussian law, with an optimal speed of convergence. This is a result obtained in [69]. Theorem 8. [Central Limit Theorem for size of ending continuants at a fraction of the depth.] For a Euclidean algorithm of the Good Class, and for any rational δ ]0, 1[, ∈ (a) The distribution of LU[δ] on ΩN is asymptotically Gaussian, with speed of convergence O(1/√N): there exist two constants µ[δ] and ρδ], such that, for any N, and any y R ∈ y LU[δ](u, v) µ[δ]N 1 −x2/2 1 PN (u, v); − y = e dx + O . ρ √N ≤ √2π √N " [δ] # Z−∞   EUCLIDEAN DYNAMICS 335

(b) The mean and the variance satisfy E [LU ]= µ N + ν + O(2−Nτ ), V [LU ]= ρ N + η + O(2−Nτ ), N [δ] [δ] · [δ] N [δ] [δ] · [δ] where where τ is a strictly positive constant that depends on rational δ. (c) One has: Λ′′(1) µ =1 δ, ρ = δ(1 δ)| | [δ] − [δ] − Λ′(1) | | Claims (a), (b), and (c) also hold for PN on ΩN .

7.9. Distributional analysis of bite complexity.e The third result proves that the total bit–complexity of the Extended Algorithm also follows an asymptotic Gaussian law. However, this result, described in [69] is not directly obtained with Dynamical Methods: it is a consequence of Theorem 7 applied to size–cost ℓ, and the speed of convergence is probably not optimal. The main idea is the decomposition of the extended bit-complexity B as B(u, v)= L(u, v) C (u, v)+ Y (u, v), · 0 b where L is the size defined in Section 1.4, C0 is the total cost relative to the digit b 2 3 -cost ℓ, and Y is a “remainder” cost where EN [Y ]= o(N ), VN [Y ]= o(N ). Then, since the variable L C follows an asymptotic gaussian law, it is the same for the · 0 variable B, with E [B]= µ(ℓ) N 2 + o(N 2), V [B]= ρ(ℓ) N 3 + o(N 3). b N · N · However, this method does not provide an optimal speed of convergence, and, at this moment, we dob not knowb how to obtain a speedb of convergenceb of order O(N −1/2). Theorem 9. [Central Limit Theorem for bit–complexity.] For a Euclidean algo- rithm of the Good Class, the distribution of total bit complexity B := B + B of the Extended Algorithm on ΩN is asymptotically Gaussian, with speed of convergence O(1/ N 1/3): For any N, and any y R, one has b ∈ 2 y B(u, v) µ(ℓ) N 1 −x2/2 1 PN (u, v); − · y = e dx + O , ρ(ℓ) N 3/2 ≤ √2π N 1/3 " · # Z−∞   b b where µ(ℓ) and ρ(ℓ) are the constants of Theorem 7 relative to the size–cost ℓ. b 7.10. Subdominant constants “`ala Porter”. The same tools [Perron’s formula, b b UNI Conditions] applied to Ψ[k](T ) defined in (7.6) give access to an asymptotic k expansion for EN [R ], for all our parameters of interest. In particular, they give access to subdominant constants of the expectations and variances, and relate them to spectral objects of the transfer operator. For instance, the constant µ1(1) of Theorem 7 is the Porter constant, and our study provides an alternative expression of this constant, as a function of spectral objects of the transfer operator [67]b 8. Functional Analysis. Here, we explain how to obtain functional spaces where the main properties of transfer operators described in Figure 8 may hold.F We recall that the properties needed for the analyses depend both on the kind of analysis [rational trajectories or real trajectories, average-case analysis or distri- butional analysis, see Figure 9]. All the transfer operators which are used in our analyses are summarized in Figure 5, and Figure 4 recalls the definition of the component operator in each case. 336 BRIGITTE VALLEE´

Any density transformer H acts on the Banach space 1(X): this is due to the inequality L 1 H[f](t) dt f(t) dt. | | ≤ | | ZX Z0 But the space 1(X) seems too large to be used here, since the spectrum of H when acting onL 1(X) is very often continuous: the essential property “Spectral Gap” does not hold.L The main difficulty is to find a convenient functional space where all the Properties of Figure 8 hold. This functional space must be sufficiently “large” so that H acts on it, and sufficiently “small” so that there is a spectral gap. Property UDE is true under quite general “positivity” hypotheses (for instance, theorems due to Krasnoselski [58], or cone methods as described in Baladi’s book [4]), and very often true for systems with complete branches [as soon as they are topologically mixing]. In contrast, Property SG is both central and not so easy to obtain in a quite general framework. [See [65] for a nice introduction to Spectral Theory]. There are two classes of operators for which it is easy to prove that spectrum exhibits a spectral gap : the compact operators, whose spectrum is discrete (except an accumulation point at zero) or the quasi-compact operators. We recall now this notion: For an operator L, denote by R(L) its spectral radius, i.e., the supremum of moduli λ when λ is an element of Sp(L), and by Re(L) its essential spectral radius, i.e.,| the| smallest positive number r such that any eigenvalue λ of Sp(L) with modulus λ > r is an isolated eigenvalue of finite multiplicity. For compact operators, the essential| | radius equals 0. An operator L is quasi-compact if the strict inequality Re(L) < R(L) holds. Then, except for the part of the spectrum inside the closed disk of radius Re(L), the operator behaves just like a compact operator (in the sense that its spectrum consists of isolated eigenvalues of finite multiplicity). In order to prove that Property SG holds, we have to exhibit a functional space where the density transformer acts and is compact or quasi–compact. 8.1. Compacity and analytic spaces. There exist results due to Schwartz [87], Shapiro and Taylor [92], Shapiro [91] which exhibit sufficient conditions under which transfer operators are compact on a functional space of analytic functions defined on some disk . The operator H is the sum of the component operators H , M s s,[h] and each component operator Hs,[h] is a so–called composition operator of the form f g f h, where the inverse branch h is an analytic function which maps inside7→ · ,◦ and g an analytic function defined on . It is then possible to relateM the propertiesM of the operator and the position ofM the image h( ) with respect to the boundary of . More precisely, there are two distinct situations,M according as the image h( )M lies strictly inside or not. M M First Situation. The image h( ) lies strictly inside . More precisely, suppose that thereM exists an open disk M such that (i) every LFT h has an analytic continuation on M, and maps the closure of disk inside∈ H; M M (ii) ForM each h M, there exists δ(h) < 1 for which the analytic continuation of the ∈ H function h′ , denoted by h, satisfies 0 < h(z) δ(h) for all z | | s/2 −s/2 | |≤ ∈M (iii) the series h∈H δ(h) [det h] converges on the plane (s) > α for some α< 1. e · e ℜ Then, the convenientP functional space will be the space A ( ) of all functions ∞ M f that are holomorphic in the domain and are continuous on the closure . M M EUCLIDEAN DYNAMICS 337

Endowed with the sup-norm, f = sup f(u) ; u , || || {| | ∈ M} A ( ) is a Banach space. Under previous conditions, the transfer operator oper- ∞ M ator Hs acts on ∞( ) for (s) > σ and is compact. It is moreover nuclear of order 0 (in the senseA ofM Grothendieckℜ [40], [41]). Property (i) is essential here, and it is necessary that the closure of disk is mapped inside . M M M Mayer [72, 73, 71] deeply studied the transfer operator Hs relative to the Classical Euclidean Dynamical System [often called the Ruelle-Mayer operator] and proved that H satisfies properties (i), (ii), (iii) for some disk . He deduced the nuclearity s M of such an operator on A∞( ). These properties were generalized to any good algorithm of Type 1 in [107].M For algorithms of the Bad Class, it will be the same for the transfer operator Hs relative to the induced system : see [106], [107]. Then, for all the algorithms of the Easy Class, it is possible to work with compact operators on sets A ( ) of analyticale functions, for a convenient disk . ∞ M M Second Situation. The image h( ) lies inside , but the frontier of h( ) may “touch” the frontier of . M M M More precisely, supposeM that there exists an open disk such that every LFT h has an analytic continuation on , and maps the diskM inside . ∈Then H the convenient space will be theM Hardy space 2( ).M We considerM a disk whose frontier is denoted by δ. We then consider theH spaceM of functions defined Min , that are analytic inside and such that the quantity M M 1 f 2 := f(z) 2 dz || ||2 2πρ | | | | Zδ is finite. This space is classically denoted by 2( ) and is called the Hardy space H M of order two associated to the disk . The quantity f 2 defined above is a norm which endows 2( ) with a structureM of Banach space,|| || even more of Hilbert H M space. Each component operator Hs,[h] is a composition operator which acts on 2( ) and is compact as soon as h maps the disk inside . As previously, it His moreoverM nuclear of order 0 (in the sense of GrothendieckM M [40], [41]. When the series which defines Hs as a sum of component operators Hs,[h] is convergent in 2( ), the same properties hold for the operator H . H M s This framework is well adapted for the induced version H of the Binary Algo- rithm, which is defined in (3.6), see [105]. e 8.2. Quasi–compacity. The following theorem, due to Hennion [43] is a generali- sation of previous theorems due to Ionescu-Tulcea and Marinescu, or Lasota-Yorke. It gives sufficient conditions that entail that an operator is quasi–compact. It deals with some Banach space endowed with two norms, a weak norm . and a strong norm . , for which the unitF ball of ( , . ) is precompact in ( , .|).| || || F || || F | | Theorem [Hennion, Ionescu-Tulcea and Marinescu, Lasota-Yorke]. Suppose that the Banach space is endowed with two norms . and . , and the unit ball of ( , . ) is precompactF in ( , . ). Let L be a bounded| | operator|| || on ( , . ). Assume F || || F | | F || || that there exist two sequences rn and tn of positive numbers such that, for all n 1, one has { } { } ≥ Ln[f] r f + t f . (8.1) || || ≤ n · || || n · | | Then, the essential spectral radius of the operator L on ( , . ) satisfies F || || 1/n Re(L) r := lim inf (rn) . ≤ n→∞ 338 BRIGITTE VALLEE´

If, moreover, the spectral radius R(L) in ( , . ) satisfies R(L) > r, then the operator L is quasi-compact on ( , . ). F || || F || || This general Theorem has many applications in our framework. (i) Good Class. For algorithms of the Good Class, one chooses := 1(X), F C the weak norm is the sup-norm f 0 := sup f(t) , while the strong norm is the ||′ || | | norm f 1 := sup f(t) + sup f (t) . Then, the density transformer satisfies the hypotheses|| || of Hennion’s| | Theorem.| Note| that Properties (P 1), (P 2) in Figure 2 are essential here. (ii) Bad Class. The previous statement is also true for the transfer operator relative to the induced systems associated to the Bad Class, since the induced set fulfills Properties (P 1), (P 2) [see Section 2.6]. H (iii) Type 4. For this type, one uses various functional spaces, with various e applications of Hennion’s Theorem. We work both in the space Hα(J) of α–H¨older functions [the strong norm is the α–H¨older norm, and the weak norm is the 1 norm] and in the space 0(J)) of continuous functions [the strong norm is now theL norm sup, and the weakC norm is the 1 norm]. L

8.3. Study of the underlined operator. Recall that the underlined operators act on functions F of two variables, and their components are of the form

H [F ](x, y) := δs−w h′(x) s h′(y) −w F (h(x),h(y)). s,w,[h] h · | | · | | · On the diagonal x = y, the function F (x, x) is denoted by f(x) and the equality Hs,w,[h][F ](x, x) = Hs−w[f](x) holds. When the Bounded Distortion Property holds, it is –at least intuitively– clear that the behaviour of the underlined operator Hs,w is “close” to the plain operator Hs−w.

Consequently, there are two main cases. The Easy Class, for which Property (P 2) of Figure 2 holds, or the Difficult Class, where it does not hold. Good Class. One chooses := 1(X X), the weak norm is the sup-norm F C × F 0 := sup F (x, y) , while the strong norm is the norm F 1 := sup F (x, y) + ||sup||DF (x, y)| , where| DF (x, y) denotes the differential of||F ||at (x, y).| Then, the| | | transfer operator Hs,w satisfies the hypotheses of Hennion’s Theorem, and is proven to be quasi–compact. Bad Class. The previous statement is also true for the transfer operator relative to the induced systems associated to the Bad Class. Difficult Class. For Type 3 or Type 4, neither Property (P 1) nor Property (P 2) hold, and we do not succeed to apply Hennion’s theorem: We do not know how to obtain a functional space where the underlined operators are proven to be quasi–compact. F

Easy Class. It is also possible to work inside the Banach space A∞( ), for a convenient disk which contains the real interval X of the relativeM×M dynam- ical system; in this case,M the underlined transfer operators [the underlined transfer operators for the Good Class or the “induced” underlined transfer operator for the Bad Class] have very nice supplementary properties, for instance compacity and nuclearity. EUCLIDEAN DYNAMICS 339

Type Plain Operator Underlined Operator Types 0,1, 2 C1(X) C1(X × X)

A∞(M) A∞(M×M) Binary H2(M) ———– LSB C1(J), C0(J) ———–

Figure 21. Functional spaces associated to each operator.

8.4. Choice of the functional Space. We summarize the possible choices. Transfer operators on functions of one variable. Type 1 and 2. As we saw it, there are two possible choices (i) the Banach space A∞( ), for a convenient disk which contains the real interval X of the relative dynamicalM system; in this case,M the transfer operators [the plain transfer operators for the Good Class or the “induced” transfer operator for the Bad Class] have very nice supplementary properties, for instance compacity and nuclearity. (ii) the Banach space 1(X), which is easier to use. For instance, results `ala Dolgopyat are proven to holdC in this space, and not in the previous space. Type 3. For the induced Binary System, we choose as the Hardy space 2( ) relative to a disk of diameter [0,ρ] with 1 <ρ< 2. WeF did not succeed inH findingM a convenient functionalM space for the Plus-Minus Algorithm. Type 4. We choose as both spaces 1(J), 0(J). F C C Transfer operators on functions of two variables [only for the Easy Class]. As previously there are two possible choices (i) the Banach space A∞( ), for a convenient disk which contains the real interval X of the relativeM×M dynamical system; in this case,M the transfer operators [the plain transfer operators for the Good Class or the “induced” transfer operator for the Bad Class] have very nice supplementary properties, for instance compacity and nuclearity. (ii) the Banach space 1(X X), which is easier to use. C × 8.5. General spectral properties of transfer operators. We now describe the main spectral properties of the transfer operator Hs,w [plain, with a hat, or under- lined] on this convenient functional space . All these properties are easy conse- quences of three central properties for the densityF transformer H: Property UDE: Unique Dominant Eigenvalue Property SG: Spectral Gap Properties An? : various analyticity properties. Consider a Euclidean dynamical system (X, V ) of any type and the functional space previously defined in Figure 21. Consider any of the three transfer opera- F tors: the operators Hs,w,(c) or Hs,w,(c) associated to a cost of moderate growth, or an underlined transfer operator Hs,w. In the following, the operator Gbs,w denotes: – for the Good Class, any of the three previous operators. – for the Bad Class, any of the induced versions of the three operators. – for the Difficult Class, only the operators Hs,w or Hs,w associated to a cost of moderate growth. b 340 BRIGITTE VALLEE´

In any cases, there exist an interval Σ :=]σ , + [ with σ < 1 and a real 0 0 ∞ 0 neighborhood W0 of w = 0 for which the following eight properties are true when (σ = s, ν = w) belongs to Σ W : ℜ ℜ 0 × 0 (1) [Quasi-compactness.] The operator Gs,w acts boundedly on , and Gs,w is (uniformly) quasi-compact for real (s, w). F

(2) [Unique dominant eigenvalue.] For real (σ, ν) Σ0 W0, Gσ,ν has a unique eigenvalue λ(σ, ν) of maximal modulus, which is real∈ and× simple, the dominant eigenvalue. The associated eigenfunction fσ,ν is strictly positive, and the associated ∗ eigenvector µσ,ν of the adjoint operator Gσ,ν is a positive Radon measure. With the normalization conditions, µσ,ν [1] = 1 and µσ,ν [fσ,ν ] = 1, the measure µσ,ν := fσ,νµσ,ν is ab probability measure. In particular, µ1 is the Haar measure, with λ(1) = 1, and f1,0 = ψ the invariantb density ofb the dynamical system.. (3) [Spectralb gap.] For real parameters (σ, ν) Σ b W , there is a spectral gap, ∈ 0 × 0 i.e., the subdominant spectral radius rσ,ν Re(σ, ν) defined by rσ,ν := sup λ ; λ Sp(G ), λ = λ(σ, ν) , satisfies r < λ(σ,≥ ν). {| | ∈ σ,ν 6 } σ,ν (4) [Analyticity in compact sets.] The operator Gs,w depends analytically on ±1 ±1 ′ (s, w). Thus, λ(σ, ν) , fσ,ν , and fσ,ν depend analytically on (σ, ν). (5) [Analyticity in a neighborhood of (1, 0).] If (s, w) is complex near (1, 0) then ±1 ±1 ′ λ(s, w) , fs,w, and fs,w are well-defined and analytic; moreover, for any θ, with r <θ< 1, one has r / λ(1, w) θ. 1 1,w | |≤ (6) [Derivatives of the pressure.] The first derivatives of the dominant eigenvalue ′ ′ function λ(σ, ν) of the plain operator at (1, 0) satisfy the following: λ (1) = λs(1, 0) is the opposite of the entropy of the dynamical system (V, dx), and, in the case of ′ a cost c, λw(1, 0) is the average of the cost:

′ ′ λ (1) = α = δh log δh log V (t) ψ(t)dt − − − X | | hX∈H Z ′ λw(1, 0) = µ(c)= δh c(h) ψ(t) dt. · h(X) hX∈H Z (7) [Function w σ(w).] There is a complex neighborhood of 0 and a unique function σ : 7→ C such that λ(σ(w), w) = 1, this functionW is analytic, and σ(0) = 1. W → (8) Furthermore, for the Good Class, there exist relations between the dominant eigenvalues of the three operators Hs,w, Hs,w and Hs,w, namely λ(s, w)= λ(s, w), λ(s, w)= λ(s w, 0). b − 8.6. Properties SM,b SLC, UNI, US. These properties are not automatic con- sequences of the three main properties UDE, SG, An. As we already said, some of these properties do not hold for dynamical systems with affine branches. However, as soon as a dynamical system is not 2 conjugated with a dynamical system with affine branches, Property SM holds. PropertyC SLC also holds in this case provided the cost c is not constant (see for instance Lemma 7 of [7]). (9) [Property SM]. For any t = 0, the spectral radius R(σ + it, 0) satisfies R(σ + it, 0) < R(σ, 0). 6 (10) [Property SLC]. For any (q, r) = (0, 0), the second derivative of the pressure function w log λ(1 + qw,rw) is not6 zero at w = 0. 7→ EUCLIDEAN DYNAMICS 341

For Euclidean dynamical systems, all the branches are LFT’s, and it is easy to prove that these systems are not 2 conjugated to dynamical systems with affine branches. Then, these two propertiesC SM and SLC hold for all our Euclidean dynamical systems. On the other hand, Condition UNI [Strong Condition UNI, or only Weak Condition UNI], when it is fulfilled, entails that all the three properties SM, SLC, US hold.

8.7. Conclusion of the Functional Analysis Study. Finally, this Section proves the following facts — Theorem 1 holds for all Systems of the Fast Class. — Theorem 2 holds for all systems of the Good Class. — Theorems 3, 6 hold for all the systems. — Theorems 4, 5 hold for the Fast Class. — Theorems 7, 8, 9 hold for all the Good Class.

9. Historical Notes, Possible extensions and Open Problems. Here, we provide a complete description of related works, and state some open problems.

9.1. Euclidean Algorithms and Worst-case Analysis. For a description of Euclidean Algorithms, see Knuth’s and Shallit’s vivid accounts [56, 89]. Classical Euclidean Algorithms. Euclid’s Algorithm based on the usual division was discovered as early as 300BC, and is “the grandfather of all the algorithms”, as Knuth says. Euclidean Algorithm was analysed first in the worst case in 1733 by de Lagny, The Centered algorithm (K) has been considered by Rieger [83]. The Even Algorithm is introduced by Eisenstein [32]. The Even and Odd algorithms are described in [94, 95]. Pseudo–Euclidean Algorithms. Two of these Algorithms, the Pseudo-Classical (G˘), the Pseudo-Centered (K˘ ) have been studied by Shallit [88] who limited himself to a worst-case analysis and wrote “Determining the average behaviour for these algorithms seems quite hard.” Then, Vall´ee introduces a general formalism for what she called pseudo-euclidean algorithms [106], [107]. Binary, Plus-Minus Algorithms. The Binary algorithm of Stein [96] is described for instance in Knuth [56] while the Plus-Minus algorithm is due to Brent and Kung [15]. LSB Algorithm. Finally, Stehl´eand Zimmermann proposed to consider divisions that are totally directed by the LSB’s, which then lead to the integer analogue to increasing–degree gcd algorithm for polynomials. Such an algorithm is described in [98] for instance, where the authors also provide a worst–case analysis of this algorithm. Lehmer-Euclid algorithm, Interrupted Algorithm. The Lehmer-Euclid algorithm is an improvement of the Euclid algorithm when applied for large integers. It was introduced by Lehmer [62] and first analyzed in the worst–case by Sorenson [97]. It uses what Daireaux et Vall´ee have called the Interrupted Euclidean algorithm [24]. This interrupted algorithm depends on some parameter α [0, 1], and, when running with an input (u, v), it performs the same steps as the∈ usual Euclidean algorithm, but it stops as soon as the current integer is smaller than vα. 342 BRIGITTE VALLEE´

9.2. Dynamical Euclidean systems and transfer operators. We summarize here the main works about the continuous Euclidean framework. Dynamical systems. See for instance [70] for a readable treatment of dynamical systems of intervals, and [9] for a general overview on dynamical systems. The Classical Euclidean system was first studied by Gauss himself. The density trans- former, also known as the Perron-Frobenius operator, was introduced early in the study of continued fractions (see for instance L´evy [63], Khinchin [54], Kuzmin [59], Wirsing [111] and Babenko [3]). It was more recently deeply studied by Mayer, in a sequence of papers [72, 73, 71, 74, 75, 76]. The Centered system was studied by Rieger [83, 84], the Even system by Schweiger, Bauer, Kraaicamp and Lopes [94, 8, 55], the Odd System by Schweiger [94]. The dynamical system for polyno- mials was described in [11]. Transfer operators. See the book of V. Baladi [4] for a general overview on transfer operators. The density transformer is a special case of a transfer operator, and the general notion of transfer operators was introduced by Ruelle, in connection with his thermodynamic formalism (see for instance [85, 86]). Then Mayer has applied such operators to the classic continued fraction transformation. After works of Chernov [21], Dolgopyat [29] was interested in the decay of correla- tions for hyperbolic flows satisfying some uniform nonintegrability condition (UNI). Later on, Pollicott and Sharp used Dolgopyat’s bounds together with Perron’s for- mula to find error terms in asymptotic estimates for geodesic flows on surfaces of variable negative curvature; see e.g. [81], where only univariate Dirichlet series with positive cofficients appear. Truncated trajectories and metrical properties of continued fractions.. Central Limit Theorem for costs [stated here as Theorem 1] is quite well-known. See for instance [22] or [17] for interval maps, and [1] for a more abstract framework and references to the pioneering paper of Nagaev [78]. The situation is less clear for continuants: There are previous works due to Philipp [80] which have been generalized by Vall´ee [101]. These results are extended to our general framework for the first time in the present paper. A survey for metrical properties of continued fractions is [50].

9.3. Euclidean Analysis. Inside the Euclidean framework, most of dynamical studies concern the continuous point of view [metric properties of continued fraction expansions for instance], and not the discrete analysis of gcd algorithms. On the otherhand, most of the analyses of Euclidean Algorithms do not adopt a dynamical point of view. The methods used till the early 1980’s are quite various, and they range from combinatorial (de Lagny, Heilbronn) to probabilistic (Dixon). Average-case analysis. The standard Euclidean Algorithm was analysed first in the average-case around 1969 independently by Heilbronn [42] and Dixon [28]. The centered algorithm was studied by Rieger [83]. Brent [14] has analysed the Binary algorithm under some heuristic hypotheses. Brent’s work deals with the operator H relative to the plain [i.e., not induced] Binary Euclidean System defined in (3.4), and he conjectures that there exists a limit density for the algorithm. Then, he makes a (essential) heuristic hypothesis: the rationals have a “typical” behaviour inside the reals, so that the restriction to the rationals of the limit (real) density is also the limit (rational) density. Then, under the conjecture and the heuristic hypothesis, he obtains the average–case analysis of the Binary Algorithm (B). The Subtractive algorithm (T ) was studied by Knuth and Yao [112]. Results on the average-case analysis of the polynomial gcd can be found in [38, 56]. EUCLIDEAN DYNAMICS 343

Distributional analysis. Concerning the standard Euclidean algorithm and the num- ber of steps (i.e., the constant cost c 1), Hensley [44] has obtained a Central Limit ≡ Theorem, and a Local Limit Theorem with speed of convergence O((log N)−1/24). Hensley has used a transfer operator Hs,0, to obtain distributional results on ra- tional trajectories upon aproximating discrete measures on rationals by continuous measures. In particular, his approach avoids parameters s of large imaginary parts.

9.4. Dynamical Euclidean Analysis. We now cite the main works of our group which are closely related to the present survey. Note that the Caen group intro- duced dynamical methods in another algorithmic domain, the Information Theory Domain. See [104] for an instance of such a work. Average-case dynamical analysis. A precise description of Euclidean analyses can be found in the following papers. Paper [35] is itself a survey paper where transfer operators are used for analysing the Euclid Algorithm together some of its general- ization on higher dimensions. Paper [101] introduces for the first time the underlined operators [for analyzing algorithms], and uses them for obtaining Theorem 2 for con- tinuants in the case of the Classical Euclidean Algorithm. More general transfer operator with two variables are introduced in [104]. Papers [106, 107] provide an unifying point of view on Algorithms of Type 1 and 2. The analysis of the Binary Algorithm can be found in [105], while Daireaux explicits the Plus-Minus Dynami- cal System in [23]. A recent work [25] done by Daireaux, Maume-Deschamps, and Vall´ee provides the average-case analysis of algorithms of Type 4. The strange title of the paper is due to the fact that executions of such algorithms can be viewed as a race between a (dyadic) hare, and a (Lyapounov) tortoise. Papers [2, 108] introduce the main parameters: digits, continuants, bit- complexities, and gives a panorama for their analyses. Paper [24] deeply studies (in the average case) the particular parameter “continuant at a fraction of the depth”. Distributional dynamical analysis. To the best of our knowledge, the general frame- work described in Section 7, due to Baladi and Vall´ee [7] provides the first instance of a dynamical distributional analysis. The authors apply and extend powerful tools due to Dolgopyat to dynamical systems with infinitely many branches, with two different points of view: they consider the Strong UNI Condition, in [5, 7] or the Weak UNI Condition in [6]. In this way, they improve Hensley’s result [44] while extending it to a large class of cost functionals and to several algorithms and obtaining an optimal speed of convergence. The last two results of Section 7 are due to Lhote and Vall´ee [69, 67].

9.5. Open Problems. This survey shows that there yet exist many problems to solve in this area. (i) What happens for the distribution of the algorithms of the Difficult Class, namely the Binary Algorithm or the LSB Algorithms? The functional space used for the average–case analysis of the Binary Algorithm [a Hardy Space] is not so easy to deal with, and, at the moment, we do not succeed to extend Dolgopyat methods to such a space. (i) Does Theorem 8 hold for beginning continuants? This is related to a possible extension of the result of Section 7.4 to underlined operators Hs,w. (iii) On another register, the extension to “large” costs or Bad Class is likely to lead us to the realm of stable laws: see for instance Gouezel’s work [39] for occurrences of these laws in continued fraction related matters. 344 BRIGITTE VALLEE´

Figure 22. Japanese dynamical systems

(iv) There exist fast gcd algorithms [93] which are based on a Divide and Conquer method, and use the principles of the Lehmer method [61]. For a readable treatment of such algorithms, see the book of Yap [113], for instance. Dynamical Analysis methods probably apply to this class of algorithms (work in progress of Daireaux, Lhote, Maume-Deschamps and Vall´ee). 9.6. α-Euclidean Algorithms. Three Algorithms of the MSB Class are defined by the position of the remainder : the standard division relative to a remainder in [0, 1[, the centered division, with a remainder in [ 1/2, +1/2[, or the by-excess division with a remainder in [ 1, 0[. With respect to− the classification previously described, the first two algorithms− (i.e., standard and centered) belong to the Good Class, while the third one, by excess, belongs to the Bad Class. It is thus quite natural to study a “generic” Euclidean algorithm, called the α–Euclidean algorithm, where the remainder has to belong to some interval [α 1, α[, with α [0, 1]. When the parameter α varies in [0, 1], this gives rise to a− whole class of Euclidean∈ algorithms. There are now natural questions to ask: Are there other values than 0 of parameter α for which the algorithm belongs to the Bad Class? How do the number of iterations and the bit–complexity evolve with respect to α? What is the best algorithm in the whole class? Paper [19] provides some answers to these questions. All the dynamical systems α relative to α appear in a quite natural manner. First, we draw the set of all theS maps F defined on [ 1, +1] 0 by i − \{ } 1 F (x)= i i x −

for any integer i 1. Then, we only “keep” the window α α = [α 1, α] [α 1, α], and we obtain≥ the representation of the dynamicalI system× I [see− Figure× 22].− Sα

There is a main difference with the Dynamical Systems described here, which are “complete” –in the sense that all the branches are surjective–, and for which the EUCLIDEAN DYNAMICS 345 transfer operator is then proven to act on 1([0, 1]) Here, the involved dynamical C system α is no longer “complete” –in the sense that there exist some branches that areS not surjective–. Generally speaking, it is not even Markovian, and the convenient functional space is the set BV of functions defined on [0, 1] with bounded variation; If we chooseF as a weak norm the 1-norm and as a strong norm the norm f , Hennions’s Theorem (see SectionL 8.2) can be applied, and the || ||BV transfer operator Hs is quasi-compact on BV . When parameter α belongs to [1/2, 1], this dynamical system α has been first extensively studied by Ito, Tanaka and Nakada [51, 79]. This is whyS the α–Euclidean algorithms are often nicknamed as “Japanese algorithms”. Later, Moussa, Cassa, Marmi [77] provided an extension of these results to the range α [√2 1, 1/2]. ∈ − Paper [19] proves the following: (i) For any parameter α = 0, all the algorithms α belong to the Fast Class, and the analogues of Theorem 3,6 4, 5, 6 are true for allE these Algorithms. The mean values involve the entropy h(α) of the dynamical system, together with a constant Eα[ℓ] related to the digit– size. (ii) There is a central range α [√2 1, φ 1] where the average number of iterations of the Euclidean Algorithms∈ − is optimal− and independent of α. It corresponds to the number of iterations of the Centered Algorithm (K).

9.7. Generalizations of the Euclid Algorithm in higher dimensions. There are many various points of view for a generalization of the Euclidean algorithms. The lattice reduction problem. [26][109]. The lattice reduction problem consists in finding a short basis of a lattice of Euclidean space given an initially skew basis. This reduction problem is well–known to be central to many areas of approxima- tion and optimization with deep consequences in computational number theory, cryptography, and symbolic computation. In dimension d = 1, lattice reduction may be viewed as a mere avatar of the Euclidean GCD algorithm and of continued fraction expansions. Lattice reduction per se really started with Gauss who gave an algorithm that solves the problem exactly using what resembles a lifting of the Euclidean algorithm to 2–dimensional lattices. In recent times, an important discovery was made by Lenstra, Lenstra and Lov´asz in 1982 [64]; their algorithm, called the LLL algorithm, is able to find reduced bases in all dimensions d 3. The LLL algorithm itself proceeds by stages based on the Gaussian algorithm≥ as the main reduction step. Paper [26] provides a detailed analysis of the Gaussian algorithm, both in the average case and in probability. Like its one–dimensional counterpart, the algorithm is known to be of worst–case logarithmic complexity, a result due to Lagarias [60], with best possible bounds being provided by Vall´ee [100]. The analysis provided in [26] is another instance of a dynamical analysis; it deals with the transfer operator Hs relative to the Classical Euclidean Algorithm with the special value s = 2, and all the results can be expressed with the spectral objects of H2. The probabilistic behaviour of the Gaussian algorithm turns out to be appreciably different of the Euclidean Algorithm: (i) The average–case complexity of the Gaussian algorithm (measured in the number of iterations performed) is asymptotically constant, and thus essentially independent of the size of the input vectors. The expectation µ is equal to (I H )−1[1](0) and µ 1.35113 15744 . . . − 2 ∼ 346 BRIGITTE VALLEE´

(ii) The distribution of the number of iterations is closely approximated by a geometric law whose ratio is λ(2) 0.1994. (iii) The dynamics of the algorithm∼ is governed by a (conditional) limit mea- sure that constitutes the analogue of the limit measure first observed by Gauss for continued fractions. This measure has a density which is closely related to the dominant eigenfunction of H2. These results have been recently extended to study additive costs (see [109]). On average, the Gaussian algorithm is thus of complexity O(1), which is of an order different from the worst-case. The case of dimension d = 2 therefore departs signif- icantly from its 1–dimensional analogue, and it would be of interest to determine to which extent such a phenomenon propagates to higher dimensions. Our analytic knowledge of the LLL algorithm in higher dimensions is of course less advanced, but Daud´eand Vall´ee [30] already succeeded in proving that the LLL algorithm, when applied to d–dimensional lattices, has an average–case complexity 2 that is bounded from above by a constant Kd, where Kd = O(d log d). The present work thus fits as a component of a more global enterprise whose aim is to understand theoretically why the LLL algorithm performs in practice much better than worst– case bounds predict, and to quantify precisely the probabilistic behaviour of lattice reduction in higher dimensions. Comparison of rationals. [103] [36] How to compare two rationals numbers a/b and c/d [with a,b,c,d four integers of length N], if we do not wish to work with integers of length 2N? One uses a continued fraction expansion algorithm applied simulta- neously to the two numbers and stopped as soon as a discrepancy of CFE digits is encountered. This algorithm can be used to compute the sign of the determinant (ad bc) without computing the determinant itself, and it is crucial in geometric algorithms,− for instance. How many steps are necessary (on average) to compare two rationals? What is the (asymptotic) distribution of the numbers of steps when N becomes large? The two answers are the same as in the previous paragraph: (i) the average number of iterations is asymptotically constant, and the constant is equal to the previous constant µ. (ii) The distribution of the number of iterations is closely approximated by a geometric law whose ratio is λ(2) 0.1994. ∼ In [109], Vera provides an explanation of the similarity between the two algo- rithms (the Gauss Algorithm and the Comparison Algorithm). This similarity is well–described by the geometry of the domains [L k] (where L is the number of iterations of the algorithm) [see Figure 23]. For the≥ Gauss Algorithm, the domain [LG k] is built by disks whereas the domain [LC k] relative to the comparison algorithm≥ is built by squares. However, both disks and≥ squares are themselves built on the fundamental intervals h(I) of the Euclidean Algorithm. And the constant λ(2) can be read on the figure: it is approximatively the ratio between the measure of two successive domains [L = k] and [L = k + 1].

Sorting rational numbers.The sign problem leads to the more general question of sorting n numbers x1, x2,...,xn. The principle is to determine the first CFE–digit of each number, group the numbers according to their first CFE–digit, and then sort recursively the subgroups based on the second CFE–digit. The data structure which is underlying this algorithm is a digital tree (often called a trie). The analysis of such algorithm answers the following question: How many digits in total must EUCLIDEAN DYNAMICS 347

Figure 23. The domains [L = k] are drawn alternatively in black and white for rank k ≤ 4 [on the left, for the Gauss Algorithm, and on the right for the Comparison Algorithm]. be determined in order to sort n real numbers? In symbolic dynamical terms, it describes the way trajectories of n random points under the shift V evolve by sharing some common digits before branching off from each other. And the answer is : the expected number P (n) of quotients that are necessary to sort n numbers satisfy 1 P (n)= n log n + O(n), n , α · → ∞ where α is the entropy of the CFE dynamical system and the constant which appears in the term O(n) is a variant of the Porter constant [see Section 7. 10]. Other generalizations. ([95, 16, 10, 18]). The Jacobi–Perron algorithm, or its vari- ants, were introduced to generalize the continued fraction algorithm, from the point of view of the construction of a rational approximation of a vector of Rd. The con- tinued fraction algorithm (in one dimensional–case) provides all the best rational approximations of a given real x, and many different algorithms were built for gen- eralizing this property in higher dimensions. Any multidimensional continued frac- tion algorithm produces, for a given irrational vector (x , x ,...,x ) of [0, 1]d Qd 1 2 d \ a sequence of irrational vectors (p1(n)/q(n),p2(n)/q(n),...,pd(n)/q(n)) which con- verges to (x1, x2,...,xd). Very often, the algorithms are only convergent in the weak sense, i.e.

p1(n) p2(n) pd(n) lim (x1, x2,...,xd) , ,..., =0, n→∞ − q(n) q(n) q(n)   but some of them are strongly convergent, i.e.

lim q(n)(x1, x2,...,xd) (p1(n),p2(n),...,pd(n)) =0. n→∞ || − || These convergence properties are closely related with the Lyapounov exponents (see [12]) of the set of matrices used by the algorithm. In particular, if the second Lya- pounov exponent is strictly negative, then the algorithm is strongly convergent. As in the lattice reduction problem, the two dimensional–case is particular and easier to deal with, and the Jacobi-Perron algorithm is proven to be strongly convergent for d = 2. 348 BRIGITTE VALLEE´

9.8. Study of Constrained Continued Fractions. ([102] [20]). What can be said about rationals or reals whose continued fraction expansion obeys some con- traints on its digits? In a quite general setting, such sets of reals have zero measure, and it is thus interesting to study their Hausdorff Dimension. For instance, the reals whose all digits in continued fraction expansion are at most M are deeply studied since they are badly approximable by rationals, and intervene in many contexts of number theory (see [90]). Hensley precisely studied this set EM , its Hausdorff dimension tM , and exhibits the asymptotic behaviour of tM 1 when the con- straint bound M tends to [45]. These results have been| generalized− | in [102] where “periodic” constraints∞ are considered. It is also of great interest to consider more general constraints which only deal with all the digit prefix averages of continued fraction expansions. Paper [20] con- siders some digit–cost c [a weight] and studies the set FM of reals for which the weighted average of each prefix (in the continued fraction expansion) has to be bounded by M. This setting can be translated in terms of random walks where each step performed depends on the present digit, and walks under study are constrained to be always under a line of slope M. Paper [20] first provides a characterization of the Hausdorff dimension sM , in terms of the dominant eigenvalue of the weighted transfer operator Hs,w relative to the Euclidean dynamical system, and cost c. Then, it exhibits the behaviour of sM 1 when the bound M becomes large. The (dynamical) analysis involves, as in| previous− | works, the weighted transfer operator Hs,w. However, the costs to be considered here are of large growth [for instance the cost c0(d) := d is of great interest and already considered in [46]], and the weighted transfer operator is no longer analytic near the reference point (s, w)=(1, 0). This is why the analysis is quite involved. When c0(d)= d, this analysis is closely related to the Subtractive Algorithm. For performing the precise analysis of the Subtractive algorithm (T ), one needs precise information on the set of rational numbers whose digits in the continued fraction expansion have an average less than M. This discrete problem is more difficult to solve than the continuous problem solved in [20]. In the case of “fast Euclidean Algorithms”, relative to costs of moderate growth, the weighted transfer operator Hs,w is analytic at the reference point (s, w) = (1, 0). Then, we have seen in the present paper how Tauberian Theorems or Perron’s Formula allow a transfer “from continuous to discrete”. Here, it does not seem possible to use directly these tools, due to the non–analyticity of Hs,w at (1, 0). This is the same problem which we meet when we study the Bad Class.

9.9. Computation of Constants related to the analysis. ([35] [36] [26] [68] [66] [37]). It is of theoretical and practical interest to make precise the status of constants which appear in the probabilistic analysis of Euclidean Algorithms (see Finch’s book [37] for a nice introduction to classical constants). The constants which appear in the expectations (see Figure 7 are explicit as soon as the invariant density is known: this is the case for all the algorithms of Type 1, but this is no longer true for other types. How to obtain in this case an approximation for constants α and µ(c)? For any type, are the constants γ,ρ(c) of Figure 7 which intervene in the asymptotic expression of variances [in Theorems 1, 2, 7 and 8] polynomial– time computable? What is the status of constants µ, λ(2) which intervene in the analysis of Gauss Algorithm ? How to compute the Hausdorff dimensions sM ,tm of Section 8.7 ? In the case of the Euclidean Dynamical System, the authors of [26] introduce a method for computing (a finite part of ) the spectrum of transfer EUCLIDEAN DYNAMICS 349 operators. They consider a sequence of matrices n which are “truncations” of the transfer operator, and they “approximate” theM dominant part of the spectrum of the transfer operator. They observe that the sequence formed with the dominant eigenvalue λn of n seems to converge to the dominant eigenvalue λ of the transfer operator (when theM truncation degree n tends to ), with exponential speed. They ∞ conjecture the following: There exist n0,K,θ such that, for any n n0, one has n ≥ λn λ Kθ . Lhote [66, 68] proves that the conjecture is true in a very general |framework,− |≤ as soon as the transfer operator is relative to a Dynamical System which is “strongly contracting”. He also proves that the constant θ is closely related to the contraction ratio of the Dynamical System. It is then exactly computable, and he proves in this way that the dominant eigenvalue λ (that is unique and isolated in this framework) is polynomial–time computable as soon as the truncated matrix n is computable in polynomial–time (in n). However, if one wishes to obtain provenM digits for λ, explicit values of K and n0 must be exhibited. This does not seem possible for general Dynamical Systems but Lhote proves that it is the case when the transfer operator is normal on a convenient functional space. This property actually holds for the Classical Euclidean Dynamical System, as Mayer showed it in his works. Acknowledgements. This survey summarizes the activity of the Caen Group during the last ten years. I wish to thank all the persons who participated to this group [in the alphabetic order]: Ali Akhavi, J´er´emie Bourdon, Julien Cl´ement, Benoˆıt Daireaux, Herv´eDaud´e, Charlie Lem´ee, Loick Lhote, Damien Stehl´e, An- tonio Vera. On the otherhand, this new framework which mixed two domains —analytic combinatorics and dynamical systems— could not have been elaborated without the parallel influence and help of specialists in each of these domains: many thanks to Viviane Baladi, Philippe Flajolet, V´eronique Maume, Bernard Schmitt.

References

[1] Aaronson, J., and Denker, M. Local limit theorems for partial sums of stationary sequences generated by Gibbs-Markov maps, Stoch. Dyn. 1 (2001) pp 193–237 [2] Akhavi, A., Vallee,´ B. Average bit–complexity of Euclidean Algorithms, Proceedings of ICALP’2000, Lecture Notes in Computer Science 1853, pp 373-387, Springer. [3] Babenko, K. I. On a problem of Gauss. Soviet Mathematical Doklady 19, 1 (1978), pp 136– 140. [4] Baladi, V. Positive Transfer operators and decay of correlations, Advanced Series in non linear dynamics, World Scientific, 2000. [5] Baladi, V., and Vallee,´ B. Distributional analyses of Euclidean algorithms, Proceedings of Alenex–ANALCO’04, pp 170–184. [6] Baladi, V., and Vallee,´ B. Exponential Decay of Correlations for surface semi-flows without finite Markov partitions, to appear in the Proceedings of the American Mathematical Society, 2004. [7] Baladi, V., and Vallee,´ B. Euclidean Algorithms are Gaussian, to appear in Journal of Number Theory. [8] Bauer, M. and Lopes, A. A billiard in the hyperbolic plane with decay of correlations of type n−2, Discrete and continuous dynamical systems 3 (1997) pp 107-116. [9] Bedford, T., Keane, M., and Series, C., Eds. Ergodic Theory, Symbolic Dynamics and Hyperbolic Spaces, Oxford University Press, 1991. [10] Bernstein, L. The Jacobi-Perron algorithm, its theory and application, Lecture Notes in Mathematics 207, Springer 1971. [11] Berthe,´ V. and Nakada, H. On Continued Fraction Expansions in Positive Characteristic: Equivalence Relations and some metric properties. Expositiones Mathematicae 18 (2000) pp 257–284. 350 BRIGITTE VALLEE´

[12] Bougerol, P., and Lacroix, J. Products of Random Matrices with Applications to Schrodinger Operators, Progress in Probability and Statistics, Birkhauser (1985) [13] Bowen, R. Invariant measures for Markov maps of the interval, Commun. Math. Phys. 69 (1979) pp 1–17. [14] Brent, R.P. Analysis of the binary Euclidean algorithm, Algorithms and Complexity, New directions and recent results, ed. by J.F. Traub, Academic Press 1976, pp 321–355 [15] Brent, R. P. and Kung, H.T. A systolic VLSI array for integer GCD computation, ARITH- 7, Proceedings of the Seventh Symposium on Computer Arithmetic (edited by K. Hwang), IEEE CS Press, 1985, pp 118–125. [16] Brentjes, A.J. Multidimensional continued fraction algorithms. Mathematical centre tracts 145, Mathematisch Centrum, Amsterdam, 1981 [17] Broise, A. Transformations dilatantes de l’intervalle et th´eor`emes limites, Ast´erisque 238, pp 5–109, Soci´et´eMath´ematique de France, 1996. [18] Broise, A. Fractions continues multidimensionnelles et lois stables. Bulletin de la Soci´et´e Math´ematique de France, 124 no. 1 (1996), p. 97-139 [19] Bourdon, J. Daireaux, and B. Vallee,´ B. Dynamical analysis of α-Euclidean Algorithms, Journal of Algorithms 44 (2002) pp 246–285. [20] Cesaratto, E., and Vallee,´ B. Hausdorff dimension of reals with bounded weighted aver- ages, Proceedings of Colloquium on Mathematics and Computer Science: Algorithms, Trees, Combinatorics and Probability, M. Drmota et al., ed., pp 473–490, Birkhauser Verlag, Trends in Mathematics, 2004. [21] Chernov, N. Markov approximations and decay of correlations for Anosov flows, Ann. of Math. (2) 147 (1998) 269–324. [22] Collet, P. Some ergodic properties of maps of the interval, Dynamical systems, Proceedings of the first UNESCO CIMPA School on Dynamical and Disordered Systems (Temuco, Chile, 1991), Hermann, 1996. [23] Daireaux, B. Master Thesis, Universit´ede Caen, 2001. [24] Daireaux, B., and Vallee,´ B. Dynamical Analysis of the Parametrized Lehmer-Euclid Al- gorithm, Combinatorics, Probability, Computing, pp 499–536 (2004). [25] Daireaux, B., Maume-Deschamps, V., and Vallee,´ B. The Lyapounov Tortoise and the Dyadic Hare, to appear in Discrete Mathematics and Theoretical Computer Science (2005). [26] Daude,´ H., Flajolet, P., and Vallee,´ B. An average-case analysis of the Gaussian algo- rithm for lattice reduction, Combinatorics, Probability and Computing (1997) 6 pp 397–433 [27] Delange, H. G´en´eralisation du Th´eor`eme d’Ikehara, Ann. Sc. ENS, (1954) 71, pp 213–242. [28] Dixon, J. D. The number of steps in the Euclidean algorithm, Journal of Number Theory 2 (1970), pp 414–422. [29] Dolgopyat, D. On decay of correlations in Anosov flows, Ann. of Math. 147 (1998) pp 357–390. [30] Daude,´ H. and Vallee,´ B. An upper bound on the average number of iterations of the LLL algorithm, Theoretical Computer Science 123 (1994) pp 95-115. [31] Ellison, W. and Ellison, F. Prime Numbers, Hermann, Paris, 1985. Eisenstein, G. a [32] Einfacher Algorithmus zur Bestimmung der Werthes von ( b ), J. f¨ur die Reine und Angew. Math. 27 (1944) pp 317-318. [33] Flajolet, P. Analytic analysis of algorithms, In Proceedings of the 19th International Col- loquium “Automata, Languages and Programming”, Vienna, July 1992, W. Kuich, editor, Lecture Notes in Computer Science 623, pp 186–210 [34] Flajolet, P. and Sedgewick, R. Analytic Combinatorics, Book in preparation (1999), see also INRIA Research Reports 1888, 2026, 2376, 2956. [35] Flajolet, P., and Vallee,´ B. Continued fraction Algorithms, Functional operators and Structure constants, Theoretical Computer Science 194 (1998), pp 1–34. [36] Flajolet, P., and Vallee,´ B.Continued Fractions, Comparison Algorithms, and Fine Struc- ture Constants, Constructive, Experimental et Non-Linear Analysis, Michel Thera, Editor, Proceedings of Canadian Mathematical Society, Vol 27 (2000), pp 53-82 [37] Finch, S. R. Mathematical Constants, Cambridge University Press, 2003. [38] Friesen, C., and Hensley, D. The statistics of continued fractions for polynomials over a finite field, Proceedings of the American Mathematical Society, 124, (1996) 9, pp 2661–2673, [39] Gouezel, S. Central limit theorem and stable laws for intermittent maps, Prob. Theory and Related Fields 128 pp 82–122 (2004) EUCLIDEAN DYNAMICS 351

[40] Grothendieck, A. Produits tensoriels topologiques et espaces nucl´eaires, Mem. Am. Math. Soc. 16 (1955) [41] Grothendieck, A. La th´eorie de Fredholm, Bull. Soc. Math. France 84 pp 319-384. [42] Heilbronn, H. On the average length of a class of continued fractions, Number Theory and Analysis, ed. by P. Turan, New-York, Plenum, 1969, pp 87-96. [43] Hennion H. Sur un th´eor`eme spectral et son application aux noyaux lipschitziens, Proc. Amer. Math. Soc. 118 (1993) pp 627–634 [44] Hensley, D. The number of steps in the Euclidean algorithm, Journal of Number Theory 49, 2 (1994), pp 142–182. [45] Hensley, D. Continued Fraction Cantor sets, Hausdorff dimension, and functional analysis, Journal of Number Theory 40 (1992) pp 336-358. [46] Hensley, D. The statistics of the continued fraction digit sum, Pacific Journal of Mathe- matics, Vol. 192, No2, 2000. [47] Hwang, H.-K. Th´eor`emes limite pour les structures combinatoires et les fonctions arithm´etiques, PhD thesis, Ecole Polytechnique, Dec. 1994. [48] Hwang, H.-K. Large deviations for combinatorial distributions: I. Central limit theorems, The Annals of Applied Probability 6 (1996) pp 297–319. [49] Hwang, H.-K. On convergence rates in the central limit theorems for combinatorial structures, European Journal of Combinatorics 19 (1998) pp 329–343. [50] Iosifescu, M. and Kraaicamp, C. Metrical Theory of Continued Fractions. (2002) [51] Ito, S. and Tanaka, S. On a family of continued fraction transformations and their ergodic properties Tokyo J. Math 4 (1981) pp 153–175. [52] Jacobi, C.G.J. Uber die Kreistheilung und ihre Anwendung auf die Zalhentheorie, J. f¨ur die Reine und Angew. Math. 30 (1846) pp 166–182. [53] Kato, T. Perturbation Theory for Linear Operators, Springer-Verlag, 1980. [54] Khinchin, A. I. Continued Fractions. University of Chicago Press, Chicago, 1964. A transla- tion of the Russian original published in 1935. [55] Kraaikamp, C. and Lopes, A. The Theta group and the continued fraction expansion with even partial quotients. preprint, 1995 [56] Knuth, D.E. The art of Computer programming, Volume 2, 3rd edition, Addison Wesley, Reading, Massachussets, 1998. [57] Knopfmacher, J. and Knopfmacher, A. The exact length of the Euclidean algorithm in Fq[X], Mathematika, 35, (1988), pp 297-304 [58] Krasnoselsky, M. Positive solutions of operator equations, P. Noordhoff, Groningen, 1964. [59] Kuzmin, R. O. Sur un probl`eme de Gauss, Atti del Congresso Internationale dei Matematici 6 (Bologna, 1928) pp 83-89. [60] Lagarias, J. C. Worst–case complexity bounds for algorithms in the theory of integral quadratic forms, Journal of Algorithms 1, 2 (1980), pp 142–186. [61] Lebesgue V. A. Sur le symbole (a/b) et quelques unes de ses applications, J. Math. Pures Appl. 12 pp 497–517 [62] Lehmer, D. H. Euclid’s algorithm for large numbers. Am. Math. Mon. (1938) 45 pp 227– 233. [63] Levy,´ P. Sur les lois de probabilit´edont d´ependent les quotients complets et incomplets d’une fraction continue. Bull. Soc. Math. France 57 (1929) pp 178-194 [64] Lenstra, A. K., Lenstra, H. W., and Lovasz,´ L. Factoring polynomials with rational coefficients, Mathematische Annalen 261 (1982), pp 513–534. [65] Lorch, E. R. Spectral Theory, Oxford University Press, New York, 1962. [66] Lhote, L. Master Thesis, Universit´ede Caen, 2002 [67] Lhote, L. PhD Thesis, Universit´ede Caen, (in preparation). [68] Lhote, L. Computation of a Class of Continued Fraction Constants Proceedings of Alenex– ANALCO’04, pp 199–210 [69] Lhote, L., and Vallee,´ B. Sharp estimates for the main parameters of the Euclid Algorithm. submitted [70] Lasota, A. and Mackey, M. Chaos, Fractals and Noise; Stochastic Aspects of Dynamics, Applied Mathematical Science 97, Springer (1994) [71] Mayer, D. H. On a ζ function related to the continued fraction transformation, Bulletin de la Soci´et´eMath´ematique de France 104 (1976), pp 195–203. 352 BRIGITTE VALLEE´

[72] Mayer, D. H. Continued fractions and related transformations, In Ergodic Theory, Sym- bolic Dynamics and Hyperbolic Spaces, T. Bedford, M. Keane, and C. Series, Eds. Oxford University Press, 1991, pp. 175–222. [73] Mayer, D. H. Spectral properties of certain composition operators arising in statistical mechanics, Commun. Math. Phys. pp 68, 1-8 (1979) [74] Mayer, D. H. On composition Operators on Banach spaces of Holomorphic Functions, Journal of functional analysis 35 pp 191-206 (1980) [75] Mayer, D. H. On the thermodynamic formalism for the Gauss Map, Commun. Math. Phys. 130, pp 311-333 (1990) [76] Mayer, D., and Roepstorff, G. On the relaxation time of Gauss’s continued fraction map. I. The Hilbert space approach, Journal of Statistical Physics 47, 1/2 (Apr. 1987), pp 149–171. II. The Banach space approach (transfer operator approach), Journal of Statistical Physics 50, 1/2 (Jan. 1988), pp 331–344. [77] Moussa, P., Cassa, A. and Marmi, S., Continued Fractions and Brjuno functions, Journal of Computational and Applied Mathematics 105 (1999) pp 403–415. [78] Nagaev, S.V. Some limit theorems for stationary Markov chains, Theor. Probab. Appl. 2 (1957) pp 378–406. [79] Nakada, H. Metrical Theory for a Class of Continued Fraction Transformations and Their Natural Extensions, Tokyo J. Math., 4 (2) (1981) pp. 399–426. [80] Philipp, W. Some metrical results in Number Theory II, Duke Math. J. 38 (1970) pp 447-488. Errata p 788. [81] Pollicott, M., and Sharp, R. Exponential error terms for growth functions on negatively curved surfaces, Amer. J. Math. 120 (1998) pp 1019–1042. [82] Prellberg, T. and Slawny, J. Maps of intervals with Indifferent fixed points: Thermody- namic formalism and Phase transitions. Journal of Statistical Physics 66 (1992) pp 503-514 [83] Rieger, G. J. Uber¨ die mittlere Schrittanzahl bei Divisionalgorithmen, Math. Nachr. (1978) pp 157–180. [84] Rieger, G. J., Uber¨ die Schrittanzahl beim Algorithmus von Harris und dem nach n¨achsten Ganzen, Archiv der Mathematik 34 (1980), pp 421–427. [85] Ruelle, D. Thermodynamic formalism, Addison Wesley (1978) [86] Ruelle, D. Dynamical Zeta Functions for Piecewise Monotone Maps of the Interval, vol. 4 of CRM Monograph Series, American Mathematical Society, Providence, 1994. [87] Schwartz, H. Composition operators in Hp, Ph.D. Thesis, Univ. of Toledo. [88] Shallit, J. On the worst–case of the three algorithmss for computing the Jacobi symbol, Journal of Symbolic Computation 10 (1990) pp 593–610. [89] Shallit, J. Origins of the analysis of the Euclidean Algorithm, Historia Mathematica 21 (1994) pp 401-419 [90] Shallit, J. Real numbers with bounded partial quotients. A survey. L’Enseignement Math´ematique, t. 38, pp 151-187, 1992. [91] Shapiro, J. Composition operators and classical function theory, Universitext: Tracts in Mathematics, Springer-Verlag, 1993. [92] Shapiro, J. and Taylor, P.D. Compact, nuclear, and Hilbert–Schmidt composition oper- ators on H2, Indiana Univ. Math. J. (1973) 23, pp 471-496 [93] Schonhage, A. Schnelle Berechnung von Kettenbruchentwicklungen, Acta Informatica pp 139–144 (1971) [94] Schweiger, F. Continued fractions with odd and even partial quotients. Mathematisches Institut der Universitat Salzburg, Arbeitsbericht 2/1982 [95] Schweiger, F. Multidimensional Continued Fractions, Oxford University Press, (2000) [96] Stein, J. Computational Problems Associated with Racah Algebra, Journal of Computa- tional Physics 1 (1967) pp 397–405. [97] Sorenson, J. An analysis of Lehmer’s Euclidean GCD Algorithm, Proceedings of ISSAC 1995, pp 254–258 [98] Stehle,´ D. and Zimmermann, P. A Binary Recursive Gcd Algorithm, Proceedings of ANTS’04, Lecture Notes in Computer Science. [99] Tenenbaum, G. Introduction `ala th´eorie analytique des nombres, vol. 13. Institut Elie´ Car- tan, Nancy, France, 1990. [100] Vallee,´ B. Gauss’ algorithm revisited, Journal of Algorithms 12 (1991), pp 556–572. [101] Vallee,´ B. Op´erateurs de Ruelle-Mayer g´en´eralis´es et analyse des algorithmes d’Euclide et de Gauss, Acta Arithmetica 81.2 (1997) pp 101–144. EUCLIDEAN DYNAMICS 353

[102] Vallee,´ B. Fractions continues `acontraintes p´eriodiques, Journal of Number Theory 72 (1998) pp 183–235. [103] Vallee,´ B. Algorithms for computing signs of 2×2 determinants: dynamics and average-case algorithms, Proceedings of the 8 th Annual European Symposium on Algorithms, ESA’97, pp 486–499, LNCS 1284, Springer Verlag. [104] Vallee,´ B. Dynamical Sources in Information Theory: Fundamental intervals and Word Prefixes, Algorithmica (2001), vol 29 (1/2) pp 262–306 [105] Vallee,´ B. Dynamics of the Binary Euclidean Algorithm: Functional Analysis and Opera- tors., Algorithmica (1998) vol 22 (4) pp 660–685. [106] Vallee,´ B. A Unifying Framework for the analysis of a class of Euclidean Algorithms., Proceedings of LATIN’00, Lecture Notes in Computer Science 1776, pp 343–354 [107] Vallee,´ B. Dynamical Analysis of a Class of Euclidean Algorithms, Theoretical Computer Science, vol 297/1-3 (2003) pp 447–486 [108] Vallee,´ B. Digits and Continuants in Euclidean Algorithms. Ergodic Versus Tauberian Theorems, Journal de Th´eorie des Nombres de Bordeaux 12 (2000) pp 531-570. [109] Vera, A. Master Thesis (2005) [110] Von Zur Gathen, J. and Gerhard, J. Modern Computer Algebra, Cambridge University Press (1999) [111] Wirsing, E. On the theorem of Gauss–Kusmin–L´evy and a Frobenius–type theorem for function spaces. Acta Arithmetica 24 (1974) pp 507–528. [112] Yao, A.C., and Knuth, D.E. Analysis of the subtractive algorithm for greatest common . Proc. Nat. Acad. Sc. USA 72 (1975) pp 4720-4722. [113] Yap, C.K. Fundamental Problems in Algorithmic Algebra, Princeton University Press (1996) Received December 2004; revised October 2005. E-mail address: [email protected]