## CONTINUED FRACTIONS OVER NON-EUCLIDEAN IMAGINARY QUADRATIC RINGS

## DANIEL E. MARTIN

Abstract. We propose and study a generalized continued fraction algorithm that can be executed in an arbitrary imaginary quadratic field, the novelty being a non-restriction to the five Euclidean cases. Many hallmark properties of classical continued fractions are shown to be retained, including exponential convergence, best-of-the-second-kind approximation quality (up to a constant), periodicity of quadratic irrational expansions, and polynomial time complexity.

## 1. Introduction

Complex continued fractions were introduced by A. Hurwitz in 1887 [7], when he applied the nearest integer algorithm to Z [ i ]. His algorithm takes as input some z = z 0 ∈ C to be approximated. The n th coefficient, a n , is then the nearest (Gaussian) integer to z n -1 . We stop if a n = z n -1 , and continue with z n = 1 ( / z n -1 -a n ) otherwise. The resulting approximations, called convergents, take the form

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-da0dc61e-6e53-4b79-ac2c-8ea6099c22d7.jpg)

Hurwitz showed that many properties possessed by this algorithm over Z still hold over Z [ i ]. For example, | q n z -p n | decreases monotonically and exponentially, the continuants, denoted q n above, increase in magnitude monotonically and exponentially, and quadratic irrationals have periodic expansions.

A key ingredient in his proofs is that | z n -1 -a n | is bounded by a constant less than 1, namely 1 / √ 2. Such a constant exists precisely because open unit discs centered on lattice points of Z [ i ] cover the complex plane. The same is true of the imaginary quadratic rings of discriminant ∆ = -3, -7, -8, and -11, but no others. This explains why the application and study of continued fractions over imaginary quadratic fields has been restricted to these five cases-the Euclidean ones.

A large collection of references for Hurwitz' algorithm can be found in [13] or [14]. Also see [9], where Lakein investigates approximation quality of Hurwitz

Date : July 12, 2022.

2010 Mathematics Subject Classification. Primary: 11A55, 11J17, 11J70, 11Y65. Secondary: 11A05, 11R11, 11Y16, 11Y40, 40A15, 52C05.

Key words and phrases. continued fractions, Euclidean, Diophantine approximation, imaginary quadratic, nearest integer algorithm.

This research was supported by NSF-CAREER CNS-1652238 under the supervision of PI Dr. Katherine E. Stange. The author is grateful to Kate Stange for so much guidance and help. The author also thanks the anonymous referee for corrections and helpful suggestions.

convergents in each Euclidean ring. See [4] for a similar algorithm removed from the ring setting, though still with a Euclidean-like requirement. See [15, 18, 17, 16] for Schmidt's algorithm, which also only functions over the five Euclidean rings. Another approximation algorithm is given by Whitley in [23]. It has continued fraction-like properties, while being executable in the four non-Euclidean, imaginary quadratic principal ideal domains, ∆ = -19, -43, -67, and -163. Whitley's idea was generalized to rings of class number 2 by Bygott [3], and as he observes, it may be further adaptable to rings with trivial principal genus (the square of every ideal is principal).

Our purpose is to apply an algorithm with similar structure to that of Hurwitz in an arbitrary imaginary quadratic field.

Notation 1.1. Let K be an imaginary quadratic field with ring of integers O and discriminant ∆.

Our algorithm, Algorithm 1, is presented in Subsection 2.2 followed by an example execution when ∆ = -23. It does not build on the algorithm of Whitley and Bygott-the only setting in which the two coincide is a Euclidean ring, in which case both simply reduce to Hurwitz' algorithm.

Let us roughly summarize our way around the non-Euclidean obstacle. When there is no choice of coefficient a n ∈ O satisfying | z n -1 -a n | &lt; 1, Algorithm 1 seeks a n near b n z n -1 instead, where b n comes from a fixed finite set B ⊂ O \{ } 0 . But the exact criteria for selecting a n and b n change according to the previous stage's choice of coefficient. We impose an analogue of the classical analytic restraint:

$$| b _ { n } z _ { n - 1 } - a _ { n } | < | b _ { n - 1 } |,$$

and a new algebraic one:

$$b _ { n - 1 } \, \Big | \, a _ { n } p _ { n - 1 } + b _ { n } p _ { n - 2 }, \, a _ { n } q _ { n - 1 } + b _ { n } q _ { n - 2 }. \, \quad \quad ( 1. 2 )$$

The integer quotients from (1.2) are p n and q n , and the algorithm continues with z n = b n -1 / b ( n z n -1 -a n -1 ). Remark that because b n need not equal 1, our convergents are called generalized continued fractions. (Some recent applications of generalized continued fractions over Z can be found in [1] and [2].)

Among pairs a n ∈ O and b n ∈ B satisfying (1.2), at least one is guaranteed to satisfy (1.1) if open discs of center a n /b n and radius | b n -1 /b n | cover C . If such a covering occurs for every n , we say B is admissible (defined more precisely in Definition 2.4). The Hurwitz algorithm has a similar requirement: Euclideanity, which is equivalent to unit discs on integers covering C . These are the five rings for which B = 1 { } is admissible.

For a given field there are many admissible sets, and each may give different continued fraction expansions of some input z . Even after fixing an admissible set, an input can have many possible continued fraction expansions because z n -1 might lie in the overlap of multiple discs of center a n /b n and radius | b n -1 /b n | . Hurwitz deals with this situation by insisting that a n be nearest to z n -1 (and b n = 1 always). Initially we make no such requirement to emphasize that the results of Section 3, like the four following theorems, are valid independently of this choice. A method for selecting among many acceptable coefficients (Algorithm 2) is not proposed until Section 4.

The first three results below are versions of the more general Theorems 3.7a, 3.9, and 3.11, where constants (meaning with respect to n and z ) depend on B .

For simplicity we have used B = { 1 2 , , ..., ⌊√ | ∆ | ⌋} , which Theorem 4.3 proves admissible, to get the following constants that depend only on ∆.

Theorem 1.2. If n ≥ 1 then | q n z -p n | is less than

$$i ) \ \frac { 2 \sqrt { | \Delta | } } { | z _ { n } q _ { n } | }, \quad i i ) \ \frac { 2 \sqrt { | \Delta | } } { | q _ { n + 1 } | }, \ \ a n d \ \ i i i ) \ \frac { 3 | \Delta | } { | a _ { n + 1 } q _ { n } | }.$$

glyph[negationslash]

Theorem 1.3. If p/q is not a convergent of z for some p, q ∈ O with q = 0 , then

$$| q _ { n } ( q _ { n } z - p _ { n } ) | < 1 6 | \Delta q ( q z - p ) |$$

for any n ≥ 1 . That is, each p n /q n is a best approximation of the second kind up to constants: if rs ≤ √ 2 / 16 ∆ | | , then 0 &lt; q | | &lt; r q | n | implies | qz - | p &gt; s q | n z -p n | for any p ∈ O except perhaps when p/q is already a convergent.

Theorem 1.4. If 0 ≤ √ n ′ &lt; n , then 16 ∆ | q n | &gt; √ 2 n -n ′ | q n ′ z n ′ | . In particular, if n ≥ 1 then 16 ∆ | q n | &gt; 2 n .

Theorem 1.5. There is a continued fraction expansion of z in which the sequence of pairs ( a n , b n n ) is eventually periodic and infinite if and only if [ K z ( ) : K ] = 2 .

Note that the last statement refers to an expansion rather than the expansion due to the potential choice among coefficients that arises in the overlapping disc scenario. Figure 4 gives an example of how some expansions of a quadratic, irrational input can be periodic while others are not. A path in the right-side image can be periodic or aperiodic, depending on the choices made at those nodes which are the source of two arrows. Such a node corresponds to ' z n -1 ' in the left-side image, which lies in the overlap of two discs, one for each arrow. More detail is given in Subsection 3.3.

Other results include the monotonic decrease of | q n z -p n | (Proposition 3.2), an upper bound on | qz - | p that implies p/q appears as a convergent (Lemma 3.8), and equating bad approximability of z to boundedness of a n /b n (Corollary 3.14).

Variations of the properties above may hold for the algorithm of Whitley and Bygott in fields of class number 1 or 2, but approximation quality is not addressed in their work. Their goal was to compute spaces of cusp forms.

Section 4 shows that Algorithm 1 can be executed in any imaginary quadratic field by explicitly producing admissible sets in Theorem 4.3. The sets we give have two advantages over a generic one. The first is efficiency-the admissibilty requirement on B guarantees coefficients exists, but not an easy way to find them. With B as in Theorem 4.3, there is a subroutine for finding coefficients, Algorithm 2, which gives Algorithm 1 polynomial complexity (Theorem 4.6).

The second advantage to using B from Theorem 4.3 is control over ( p n , q n ). In Euclidean rings with Hurwitz' algorithm or principal ideal domains with Whitley's, ( p n , q n ) = O . With Bygott's generalization to rings of class number 2, all divisors of ( p n , q n ) are ramified after appropriate scaling. A generic admissible set for Algorithm 1 loses such control, and thus potential applications like Whitley and Bygott's to the group PSL ( 2 O ). This can be partially remedied:

Theorem 1.6. If a n -1 , b n -1 , a n , and b n are found using Algorithm 2, then only ramified, non-rational primes divide ( p n -1 , q n -1 , p n , q n ) .

Admissible sets can also be precomputed for a particular ring. A brief explanation of how to do this is given in Subsection 4.2. Sample output from the precomputation algorithm described is in Table 2 for | ∆ | &lt; 50.

Some resources are available at math.ucdavis.edu/ ~ dmartin , including the tool that created the images herein and C ++ source code for Algorithm 1 and for finding admissible sets. There is also software to create Schmidt arrangements (coined and first studied by Stange [21]), fractal displays of circles in the complex plane obtained as the orbit of the real line under PSL 2 ( O ). It turns out that approximating z ∈ C with Algorithm 1 corresponds to a 'walk' along circles in a Schmidt arrangement toward z . The convergents are exactly the points of intersection between successive circles in this walk. Details can be found in the author's dissertation [10]. Continued fractions are addressed on their own here for simplicity.

## 2. A Continued Fraction Algorithm

2.1. Intuition for non-Euclidean rings. Hurwitz' algorithm can be applied in any imaginary quadratic ring, but with varying degrees of success. In this subsection we explore what happens if O is not Euclidean through an example in Q ( √ -23). Recall notation from the first page, and let M 0 denote the identity matrix.

We will need the usual recursion relation M n = M n -1 S a ( n ), where

$$M _ { n } = \begin{bmatrix} p _ { n } & p _ { n - 1 } \\ q _ { n } & q _ { n - 1 } \end{bmatrix} \quad \text{and} \quad S ( a ) = \begin{bmatrix} a & 1 \\ 1 & 0 \end{bmatrix}.$$

With z n = 1 ( / z n -1 -a n ), it follows by induction that z n can be computed by applying the M¨bius transformation associated with o M -1 n to z . That is,

$$z _ { n } = \frac { q _ { n - 1 } z - p _ { n - 1 } } { p _ { n } - q _ { n } z }.$$

Thus an improvement in approximation quality, | q n z -p n | &lt; q | n -1 z -p n -1 | , is equivalent to 1 / z | n | = | z n -1 -a n | &lt; 1. So in a non-Euclidean ring, it is still desirable (and necessary, as we show shortly) that z n -1 lie in the open unit disc centered on a n .

Let us input z = -1 26 + 0 48 , labeled '0' . . i in Figure 1, and take coefficients from the integers in Q ( √ -23). There are two choices for a 1 ∈ O whose unit discs contain z 0 : -1 and -2. If a 1 = -2, for example, then

$$z _ { 1 } = \frac { 1 } { z _ { 0 } - a _ { 1 } } \approx 0. 9 5 - 0. 6 2 i.$$

Figure 1. Unit discs around z 0 , z 1 , and z 2 with | ∆ = 23. |

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-a828f563-5fb5-41f9-b5c7-9fe2b4aced4a.jpg)

Similarly, a 2 = 1 and a 3 = ( -1 + √ -23) / 2 center the bold outlined unit discs that contain z 1 and z 2 ≈ -0 13+1 61 . But there is no such . . i disc containing z 3 ≈ 0 49 + 1 04 . . . i As a result, any choice of a 4 worsens approximation quality: | q 4 z -p 4 | &gt; q z | 3 -p 3 | .

We can persevere, perhaps searching for a clever combination a , a 4 5 , ..., a n to finally achieve | q n z -p n | &lt; q z | 3 -p 3 | . Or at the very least, there may be a sequence of coefficients that makes lim n p n /q n = z . It happens that neither is possible. The

obstruction is that M n , up to a swapping of columns which we henceforth ignore, belongs to the elementary group in SL 2 ( O )-the group generated by S a ( ) from (2.1) for a ∈ O . It is proved in [11] that if p and q are the column entries of a matrix in the elementary group, then p/q lies in the interior of a unit disc centered on an integer. Thus for any choices of a , ..., a 4 n , the distance from z 3 to the column ratios of M -1 3 M n , which belongs to the elementary group, is bounded from below by a positive constant. So the same is true of the distance between z = M z 3 ( 3 ) and the column ratios and M n . This is to say that no sequence of coefficients achieves lim n p n /q n = z .

A fix proposed by Whitley in [23] is to permit right multiplication by certain additional matrices from SL 2 ( O ). So M n = M n -1 S , where S need not take the form S a ( ). Generally, | q n z -p n | &lt; q | n -1 z -p n -1 | is equivalent to | z -S 1 1 , /S 2 1 , | &lt; / S 1 | 2 1 , | , thereby associating an open disc to S which is no longer centered on an integer if S 2 1 , is not a unit. Success occurs when we can choose matrices so that such discs cover C . This is possible exactly when O is one of the eight principal ideal domains. In a non-principal ideal domain, there is a discrete set of problematic points. The so-called singular points are not covered by open discs with center S 1 1 , /S 2 1 , and radius 1 / S | 2 1 , | for S ∈ SL ( 2 O ) [22]. The approximation quality of Whitley's algorithm suffers when ( z n n ) approaches a singular point.

Bygott goes a step further [3] and allows S from the extended Bianchi group (see Section 7.4 of [5] for a definition and basic properties). Only singular points p/q for which ( p, q ) 2 is nonprincipal are left uncovered by the newly introduced open discs. Bygott works in fields of class number 2 because no such points exist.

To lengthen the list of imaginary quadratic fields that possess an approximation algorithm, we have gone from the elementary group to SL ( 2 O ) to the extended Bianchi group. There are no more extensions to attempt. The latter is maximal among discrete groups of M¨bius transformations containing SL ( o 2 O ) [5]. The group structure must be abandoned to obtain a covering of C by open discs in fields with non-2-torsion ideal classes like Q ( √ -23). So let us return to the elementary group and consider the following modification to S a ( ).

Notation 2.1. For a, b ∈ C let

$$S ( a, b ) = \begin{bmatrix} a & 1 \\ b & 0 \end{bmatrix}.$$

It is well-known that open discs of radius 1 / b | | and center a/b cover C for a ∈ O and b from some finite set B ⊂ O \{ } 0 . For example, B = 1 2 { , } works for Q ( √ -23), introducing discs of radius 1 / 2 centered on half-integers. The resulting covering is the first image in Figure 2. As shown in the second image, the closures of these discs still cover the plane after scaling radii by √ 8 / 9. Returning to our example, the first image shows | z 3 -(1 + √ -23) / 4 | &lt; 1 / 2. So M 4 = M S 3 ((1 + √ -23) / 2 2) , gives | q 4 z -p 4 | &lt; q z | 3 -p 3 | as desired.

glyph[negationslash]

Unfortunately, continuing in this fashion does not really work. Convergents converge to z , but they may not come close in quality to the approximations that must exist by Dirichlet's box principal. The missing piece is a bound on | det M n | , which can grow exponentially when | b | = 1 in S a, b ( ). So we make an adjustment: since det M 4 = b 4 = 2, in the next stage we pick among matrices of the form S a/ , b/ ( 2 2), where a ∈ O and b ∈ { 1 2 , } . This cancels the previous determinant, and | det M 5 | = b 5 ∈ { 1 2 , } again. Since the goal is to approximate z with ratios

Figure 2. Left: discs of radius 1 and 1 / 2 on half-integers with | ∆ = 23; now | z 3 is covered. Right: scaling of radii by √ 8 / 9.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-f72c38f1-cf18-466a-968c-f113fc744f04.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-5b332555-d196-4aeb-b316-c70bbcf63942.jpg)

of integers, a 5 and b 5 are now subject to the restriction that M S a / ,b / 4 ( 5 2 5 2) be integral. Matrix multiplication shows this condition is equivalent to (1.2). Our new divisibility requirement eliminates half of the discs in Figure 2. But the ones that survive now get a disc of radius 2 /b instead of 1 /b , as in (1.1). We need this to remain a covering to guarantee containment of z 4 . It does, as can be seen in the first image of Figure 3. That we continue to obtain a covering using B = { 1 2 , } in subsequent stages of the algorithm makes this set admissible for Q ( √ -23).

It is not uncommon that a set B produces a covering at one stage (like Figure 2 for the fourth stage in the example) but not another. A few examples of such inadmissible sets are { 1 (1 + , √ -15) / 2 } for ∆ = -15, { 1 2 , } for ∆ = -31, -39, or -47, and { 1 2 (1 , , ± √ -35) / 2 } for ∆ = -35.

glyph[negationslash]

There is one subtlety regarding coefficient choice that occurs if B = 1 . In our { } example from Q ( √ -23), note that if a n and b n = 1 make M n -1 S a ( n /b n -1 , 1 /b n -1 ) integral and | z n -1 -a n | &lt; 1 / 2, then we might instead choose 2 a n and b n = 2. Indeed, M n -1 S (2 a n /b n -1 , 2 /b n -1 ) is integral and | 2 z n -1 -2 a n | &lt; 1. This doubles the resulting values of p n and q n , presenting a potential problem: the undoubled values may appear at a later index, meaning the same convergent could occur twice. This would necessitate unpleasant caveats in several of Section 3's results. As such, we insist that ( p n , q n ) be reduced to the extent that avoids this issue.

Definition 2.2. For ε ∈ (0 1), an ideal , b ⊆ O is ε -reduced if for every k ∈ K \{ } 0 , k b ⊆ O implies | k | &gt; ε 2 .

The relation between ε in Definition 2.2 and B is clarified shortly.

2.2. The algorithm. Definition 2.4 formalizes the covering requirement discussed in the previous subsection. For computations, this definition can be skipped in favor of Table 2 or Theorem 4.3.

Notation 2.3. Let D z,r ( ) denote the closed disc of radius r &gt; 0 and center z ∈ C .

glyph[negationslash]

Definition 2.4. A nonempty, finite set B ⊂ O \{ } 0 is admissible with ε ∈ (0 , 1) if for every ε -reduced ideal b with b ∩ B = , ∅

$$\mathbb { C } = \bigcup _ { a, b } D \left ( \frac { a } { b }, \frac { \varepsilon } { | b | } \right ),$$

where the union ranges over the pairs a, b for a ∈ K and b ∈ B that make ( a , b b b -1 ) integral and ε -reduced. (Here b -1 is the fractional ideal satisfying b -1 b = O .)

The value of ε in Definition 2.4 is a guaranteed measure of approximation quality improvement, | q n z -p n | ≤ | ε q n -1 z -p n -1 | . Geometrically, it is an allowable amount by which radii of discs can be scaled while preserving the covering, as shown in Figure 2.

Note that Definition 2.4 does not mention b n -1 , p n -1 , q n -1 , p n -2 , or q n -2 , all of which appear in (1.2) and therefore determine the coverings used by Algorithm 1. Since there are infinitely many values these variables might attain, a practical definition of admissibility should adjust for the redundancy of checking every potential covering. Definition 2.4 requires that b be ε -reduced, so the number of coverings checked is bounded by a small multiple of the class number (or exactly the class number if ε is sufficiently close to 1). This facilitates proofs of admissibility and searches for admissible sets. Unfortunately, it also obscures the relationship between admissibility and Algorithm 1. For example, it is likely not clear at this point why coverings indexed by b suffice. And while ' a ' from Definition 2.4 is directly related to its counterpart in lines 4-6 of Algorithm 1, they are not equal. The precise connection is postponed until Section 4.

It may be useful to first consider Algorithm 1 in a Euclidean ring with B = 1 . { } The if condition in line 5 becomes trivial and can be ignored. It is then the Hurwitz algorithm with the exception that we are not requiring a n to be the nearest integer to z n -1 , only that | z n -1 -a n | &lt; ε .

Definition 2.5. The left-column ideal of a matrix M , denoted ( M ) , glyph[lscript] is the ideal generated by its left-column entries. Define the right-column ideal , ( M ) r , similarly.

Algorithm 1. Compute continued fraction convergents of z ∈ C over O . Any method (like Algorithm 2) for choosing among multiple coefficient pairs a, b satisfying line 5 may be used.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-8831438f-fc54-4237-923a-c1075e61c247.jpg)

Notation 2.6. Let a n , b n , and M n denote ' a ,' ' b ′ ,' and ' M ' after completing the n th outer for loop iteration, with b 0 and M 0 being initial values, let z n = M -1 n ( z ), and let p n and q n denote the left column entries of M n . Its right column entries are then p n -1 and q n -1 , which we use to define p -1 = 0 and q -1 = 1.

It follows from line 6 that our variables satisfy the same relations that hold in Euclidean cases when B = { 1 } . (Results do not mention the input N or whatever the terminating index happens to be.)

## Proposition 2.7. If n ≥ 1 then

$$p _ { n } = \frac { a _ { n } p _ { n - 1 } + b _ { n } p _ { n - 2 } } { b _ { n - 1 } }, \quad q _ { n } = \frac { a _ { n } q _ { n - 1 } + b _ { n } q _ { n - 2 } } { b _ { n - 1 } }, \quad z _ { n } = \frac { b _ { n - 1 } } { b _ { n } z _ { n - 1 } - a _ { n } },$$

$$\begin{array} { c c c } \cdot & \cdot & - \\ _ { n } = \frac { a _ { n } p _ { n - 1 } + b _ { n } p _ { n - 2 } } { b _ { n - 1 } }, & & q _ { n } = \frac { a _ { n } q _ { n - 1 } + b _ { n } q _ { n - 2 } } { b _ { n - 1 } }, & & z _ { n } = \frac { b _ { n - 1 } } { b _ { n } z _ { n - 1 } - a _ { n } }, \\ & & \frac { p _ { n } } { q _ { n } } = \frac { a _ { 1 } } { b _ { 1 } } + \frac { b _ { 0 } / b _ { 1 } } { \frac { a _ { 2 } } { b _ { 2 } } + \frac { b _ { 1 } / b _ { 2 } } { \ddots } \frac { b _ { n - 1 } } { \frac { b _ { n - 1 } } { b _ { n - 1 } } + \frac { b _ { n - 2 } / b _ { n - 1 } } { a _ { n } / b _ { n } } } }, \\ d \det M _ { n } = ( - 1 ) ^ { n } b _ { n }. \end{array}$$

and det M n = ( -1) n b n .

Proof. The expressions for p n , q n , z n , and det M n follow directly from line 6 (and induction for det M n ). Viewing our matrices as M¨bius transformations, from the o new expressions for p n and q n we see that

$$\frac { p _ { n } } { q _ { n } } = M _ { n - 1 } \left ( \frac { a _ { n } } { b _ { n } } \right ) = \left ( S \left ( \frac { a _ { 1 } } { b _ { 0 } }, \frac { b _ { 1 } } { b _ { 0 } } \right ) \circ \dots \circ S \left ( \frac { a _ { n - 1 } } { b _ { n - 2 } }, \frac { b _ { n - 1 } } { b _ { n - 2 } } \right ) \right ) \left ( \frac { a _ { n } } { b _ { n } } \right ).$$

The continued fraction given in the proposition is an expansion of the right-hand side since S a, b ( )( z ) = a/b +1 /bz . glyph[square]

2.3. An example. Recall the example in Subsection 2.1 for Q ( √ - √ 23). It starts with z = -1 26 + 0 48 . . i and B = 1 2 . Let { , } ε = √ 8 / 9 and τ = (1 + -23) / 2.

Prior choices of coefficients are a 1 = -2, a 2 = 1, and a 3 = -1 + τ , which center the outlined discs in Figure 1 that contain z 0 , z 1 , and z 2 . We claim these still meet the requirements of Algorithm 1 alongside b 1 = 1, b 2 = 1, and b 3 = 1. Indeed, when b n -1 = b n = 1, the disc containment in line 4 is the same as z n -1 ∈ D a ,ε ( n ). In our example, the radii in Figure 1 can be scaled by ε and still cover z 0 , z 1 , and z 2 . Moreover, line 5's requirement that ( M n -1 S a ( n / 1 1 , / 1)) glyph[lscript] = ( M n glyph[lscript] ) be ε -reduced is satisfied since det M n = ± 1 implies ( M n glyph[lscript] ) = O .

So we keep our original three coefficients. Starting with the identity matrix, M 0 , line 6 gives

$$M _ { 1 } = \begin{bmatrix} - 2 & 1 \\ 1 & 0 \end{bmatrix}, \quad M _ { 2 } = \begin{bmatrix} - 1 & - 2 \\ 1 & 1 \end{bmatrix}, \quad \text{and} \quad M _ { 3 } = \begin{bmatrix} - 1 - \tau & - 1 \\ \tau & 1 \end{bmatrix}.$$

The previously discussed choice of a 4 = τ and b 4 = 2 also passes the if condition in line 5. Indeed, it gives

$$M _ { 4 } = \begin{bmatrix} 4 - 2 \tau & - 1 - \tau \\ - 4 + \tau & \tau \end{bmatrix},$$

and thus ( M 4 ) glyph[lscript] = ( τ, 2). This is a (split) prime over 2, which is ε -reduced regardless of the value of ε . We get z 4 = M -1 4 ( z ) ≈ 1 43 + 0 96 . . . i

Figure 3. Left: z 4 and z 6 in a disc on a /b 5 5 = a /b 7 7 = (1+ τ ) / 2. Right: z 5 and z 7 in discs on a /b 6 6 = 1 and a /b 8 8 = 2 -τ .

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-313f6ef1-3a40-44ea-adfa-c292c87a7f28.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-cb9e5f8e-2a25-43fd-b3c3-bdaffca3dcbf.jpg)

Consider the top row of M 4 . We cannot use b 5 = 1 because a (4 -2 τ )+1( - -1 τ ) is not divisible by b 4 = 2 for any a ∈ Z [ τ ]. As b 5 must come from { 1 2 , } , b 5 = 2 is forced. So line 4 looks for a 5 ∈ O ∩ D (2 z , 4 2 ), which rearranges to ε z 4 ∈ D a / , ε ( 5 2 ). Turning to the second row of M 4 , a 5 ( -4 + τ ) + 2 τ is divisible by 2 if and only if a 5 ∈ ( τ, 2). The first image of Figure 3 shows that unit discs on a/ 2 for a ∈ ( τ, 2) do indeed cover the plane with radius-scaling room to spare. In particular, we may take a 5 = 1 + τ . The highlighted disc is D ((1 + τ ) / 2 1). ,

The congruence requirement on a and b can be computed similarly from

$$M _ { 5 } = \begin{bmatrix} 7 - \tau & 4 - 2 \tau \\ - 5 & - 4 + \tau \end{bmatrix}.$$

It is a ≡ τ mod2 if b = 1, and a can be any integer if b = 2. (But a ≡ 2 τ mod4 and b = 2 needs to be reduced to a/ 2 and b/ 2 according to Definition 2.2 because 1 / 2 ≤ ε 2 = 8 9.) / The corresponding discs of radius b 5 /b = 2 /b and center a/b are displayed in the second image of Figure 3. We see that a 6 = b 6 = 2 satisfies z 5 ∈ D a /b , b /b ( 6 6 | 5 6 | ) = D (1 1), again with room to scale radii by , ε .

The arrangement of discs that occurs for z 6 , ∪ D a/b, ( 2 /b ) for a ∈ O and b ∈ { 1 2 , } that make ( M S a/b ,b/b 6 ( 5 5 )) glyph[lscript] ε -reduced, is the vertical reflection of z 4 's. So the first image of Figure 3 shows z 6 in the disc centered on a possible choice of a /b 7 7 , which happens to be the same disc we chose for z 4 . We are also able to squeeze z 7 into z 5 's image.

The resulting convergents for n ≤ 10 are given in Table 1 along with approximation quality. It can be checked that | ( q n z -p n ) | &lt; ε q | n -1 z -p n -1 | with ε = √ 8 / 9, a direct result of | b n z n -1 -a n | &lt; ε b | n -1 | .

Observe that the last two continuants satisfy | q 9 | 2 = 11916 and | q 10 | 2 = 11716. For classical continued fractions and Hurwitz' algorithm over the Euclidean rings, continuant magnitudes increase monotonically. This fails in general. But Theorem 3.11 asserts that the degree to which continuant monotonicity fails is bounded by a constant depending only on B and ε .

We end this section with a remark on the colors in Figures 2 and 3. The second image of Figure 3 is a scaled and shifted copy of Figure 2. It turns out that up

Table 1. Coefficients, convergents, and approximation quality from Algorithm 1 with ∆ = -23 using B = { 1 2 , } and ε = √ 8 / 9.

|   n | ≈ z n - 1          | a n /b n         | p n /q n                   | ≈ | q n z - p n |   |
|-----|--------------------|------------------|----------------------------|---------------------|
|   1 | - 1 . 26 +0 . 48 i | - 2 / 1          | - 2 / 1                    | 0 . 882             |
|   2 | 0 . 95 - 0 . 62 i  | 1 / 1            | - 1 / 1                    | 0 . 5459            |
|   3 | - 0 . 13 +1 . 61 i | ( - 1 + τ ) / 1  | ( - 1 - τ ) /τ             | 0 . 4754            |
|   4 | 0 . 49 +1 . 04 i   | τ/ 2             | (4 - 2 τ ) / ( - 4 + τ )   | 0 . 2757            |
|   5 | 1 . 43 +0 . 96 i   | (1 + τ ) / 2     | (7 - τ ) / ( - 5)          | 0 . 2               |
|   6 | 1 . 3 +0 . 46 i    | 2 / 2            | (11 - 3 τ ) / ( - 9 + τ )  | 0 . 1096            |
|   7 | 1 - 1 . 53 i       | (2 - τ ) / 2     | (9 - 8 τ ) / ( - 11 +5 τ ) | 0 . 0451            |
|   8 | 1 . 46 +1 . 94 i   | (1 + τ ) / 1     | (34 - 5 τ ) / ( - 25)      | 0 . 0104            |
|   9 | - 0 . 34 +4 . 32 i | ( - 2 +2 τ ) / 1 | (1 +60 τ ) / (39 - 45 τ )  | 0 . 0085            |
|  10 | 0 . 99 +0 . 72 i   | 1 / 1            | (35 +55 τ ) / (14 - 45 τ ) | 0 . 0061            |

to scaling, shifting, and reflecting, the two disc arrangements in Figure 3 are the only ones that can occur. (Such similarity of arrangements is how we get away with the apparently scant number of coverings provided by Definition 2.4.) Colors foreshadow which of the two types of arrangement occurs next: yellow for the first image in Figure 3 and blue for the second. Our choice of discs containing z 0 , z 1 , z 2 , z 4 , z 6 , and z 7 are blue, so it is a scaled or shifted copy of the second image in Figure 3 that must cover z 1 , z 2 , z 3 , z 5 , z 7 , and z 8 . Since yellow discs are chosen to cover z 3 and z 5 , a scaled, shifted, or reflected copy of the first image in Figure 3 must cover z 4 and z 6 .

Which of the two disc arrangements (either the first or second image in Figure 3) appears in stage n is determined by the ideal class of ( M n -1 ) -trivial is the glyph[lscript] second image and nontrivial the first. So when drawing discs, the appropriate color for D a/b, b/b ( ′ ) can determined by computing what the ideal class of ( M n glyph[lscript] ) would be if a and b were selected as coefficients. That is, we compute the ideal class of ( M n -1 S a/b , b/b ( ′ ′ )) -trivial glyph[lscript] gets blue and nontrivial gets yellow. Note that there are two nontrivial ideal classes for Q ( √ -23). But they are inverses, implying complex conjugation maps an ideal in one class to an ideal in another. The two disc arrangements that occur when ( M n -1 ) glyph[lscript] is conjugate are vertical reflections of one another (perhaps scaled or shifted as well). This is why the the first image in Figure 3 may appear reflected at future stages, as it is for covering z 6 in stage 7. The second image in Figure 3 is preserved by conjugation, as is true of the class of principal ideals.

It would be interesting to study whether the sequence of ideal classes of ( M n glyph[lscript] ) = ( p n , q n ), rather than the actual convergents p n /q n , still carries information about the input z .

## 3. Classical Properties

This section rifles through Hensley's litmus test for continued fractions (Section 5.2 of [6]). Essentially, properties of the nearest integer algorithm over Z are retained at the expense of constants (meaning with respect to n and z ) that grow with the discriminant magnitude | ∆ . |

3.1. Convergents. The following observation is often used without mention.

Lemma 3.1. If n ≥ 1 then | z n | ≥ 1 /ε .

Proof. By Proposition 2.7, z n = b n -1 / b ( n z n -1 -a n ). So | z n | ≥ 1 /ε is equivalent to a n ∈ D b z ( n n -1 , ε b | n -1 | ), which is from line 4 of Algorithm 1. glyph[square]

Proposition 3.2. If n ≥ 1 then | q n z -p n | ≤ ε q | n -1 z -p n -1 | . In particular, | q n z -p n | ≤ ε n .

Proof. Notation 2.6 defines z n to be M -1 n ( z ) = ( q n -1 z -p n -1 ) / p ( n -q n z ). So the first inequality in the proposition is equivalent to | z n | ≥ 1 /ε , which is the previous lemma. The second assertion follows by induction. glyph[square]

Corollary 3.3. If n ≥ 1 then a n +1 and q n are nonzero, and n marks the first occurrence of p n /q n as a convergent.

glyph[negationslash]

Proof. That q n = 0 follows from p n ∈ O and the second assertion of Proposition 3.2: | q n z -p n | ≤ ε n &lt; 1.

glyph[negationslash]

If p n ′ /q n ′ = p n /q n with n ≥ n ′ then ( q n /q n ′ )( p n ′ , q n ′ ) = ( p n , q n ) ⊆ O . Proposition 3.2 gives ε n -n ′ ≥ | q n z -p n | / q | n ′ z -p n ′ | = | q n /q n ′ | , which implies n -n &lt; ′ 2 by Definition 2.2 because ( p n ′ , q n ′ ) is ε -reduced. For the case n = n ′ +1 we have p n q n -1 -p n -1 q n = b n = 0 by Proposition 2.7.

glyph[negationslash]

glyph[negationslash]

Now that we know p n +1 /q n +1 = p n -1 /q n -1 , Proposition 2.7's formulas for p n +1 and q n +1 show that a n +1 = 0 for n ≥ 1. glyph[square]

Corollary 3.4. If z = p/q for p, q ∈ O , then p n /q n = z for some n ≤ glyph[floorleft] 1 -log ε | q |glyph[floorright] .

Proof. By Proposition 3.2, the integer q q ( n z -p n ) = q n p -p n q is bounded in magnitude by ε n | q | . Setting this equal to 1 and solving shows that q n p -p n q = 0 no later than n = 1 glyph[floorleft] -log ε | q |glyph[floorright] . glyph[square]

Notation 3.5. For a fixed admissible set B , let µ = max B | b | .

The following lemma and theorem both have a counterparts (which we are not yet ready to prove), Lemma 3.6b and Theorem 3.7b, where the directions of the inequalities are reversed.

Lemma 3.6a. If n ≥ 1 then

$$\left | 1 + \frac { q _ { n - 1 } } { q _ { n } z _ { n } } \right | > \frac { ( 1 - \varepsilon ^ { 2 } ) | b _ { n } | } { \mu }.$$

Proof. The proof proceeds by induction. The base case is n = 1, which holds using q 0 = 0, | b 1 | ≤ µ , and ε &gt; 0.

Let n &gt; 1 and assume the lemma's inequality holds when each index is decreased by one. Since | z n | ≥ 1 /ε and | b n | ≤ µ , the claim holds if | q n -1 /q n | &lt; ε by the triangle inequality-no need for induction. Otherwise, by Proposition 2.7 we have

$$\frac { 1 + q _ { n - 1 } / q _ { n } z _ { n } } { b _ { n } } = \frac { q _ { n } + q _ { n - 1 } / z _ { n } } { b _ { n } q _ { n } } = \frac { ( a _ { n } q _ { n - 1 } + b _ { n } q _ { n - 2 } ) + q _ { n - 1 } ( b _ { n } z _ { n - 1 } - a _ { n } ) } { b _ { n - 1 } b _ { n } q _ { n } } =$$

$$\frac { q _ { n - 2 } + q _ { n - 1 } z _ { n - 1 } } { b _ { n - 1 } q _ { n } } = \frac { q _ { n - 1 } z _ { n - 1 } } { q _ { n } } \left ( \frac { 1 + q _ { n - 2 } / q _ { n - 1 } z _ { n - 1 } } { b _ { n - 1 } } \right ). \quad \quad ( 3. 1 )$$

But we assumed 1 ≤ | q n -1 /εq n | , which is at most | q n -1 z n -1 /q n | by Lemma 3.1. So the final expression in (3.1) is at least | 1 + q n -2 /q n -1 z n -1 | / b | n -1 | in magnitude, which exceeds (1 -ε 2 ) /µ by the induction hypothesis. glyph[square]

Theorem 3.7a. If n ≥ 1 then | q n z -p n | is less than

$$i ) \ \frac { \mu } { ( 1 - \varepsilon ^ { 2 } ) | q _ { n } z _ { n } | }, \quad i i ) \ \frac { \mu } { ( 1 - \varepsilon ^ { 2 } ) | q _ { n + 1 } | }, \quad a n d \ \ i i i ) \ \frac { ( 1 + \varepsilon ^ { 2 } ) \mu ^ { 2 } } { ( 1 - \varepsilon ^ { 2 } ) | a _ { n + 1 } q _ { n } | }.$$

Proof. Consider the identity

$$q _ { n } z - p _ { n } = q _ { n } M _ { n } ( z _ { n } ) - p _ { n } = \frac { - \det M _ { n } } { q _ { n } z _ { n } ( 1 + q _ { n - 1 } / q _ { n } z _ { n } ) }. \quad \quad ( 3. 2 )$$

n

n +1 to get

Since det M n = ( -1) b n , we see that i ) is a rearrangement of Lemma 3.6a. To prove ii ), increment the index in (3.1) and scale both ends by q

$$\frac { q _ { n + 1 } ( 1 + q _ { n } / q _ { n + 1 } z _ { n + 1 } ) } { b _ { n + 1 } } = \frac { q _ { n } z _ { n } ( 1 + q _ { n - 1 } / q _ { n } z _ { n } ) } { b _ { n } }.$$

Up to a sign, the reciprocal of the right-hand side above equals the final expression in (3.2). So we extend (3.2) as follow:

$$\frac { - \det M _ { n } } { q _ { n } z _ { n } ( 1 + q _ { n - 1 } / q _ { n } z _ { n } ) } = \frac { ( - 1 ) ^ { n + 1 } b _ { n + 1 } } { q _ { n + 1 } ( 1 + q _ { n } / q _ { n + 1 } z _ { n + 1 } ) }.$$

Lemma 3.6a bounds the magnitude of the last expression by µ/ (1 -ε 2 ) | q n +1 | . Finally, | b n +1 z n -a n +1 | ≤ ε b | n | gives | a n +1 | ≤ | b n +1 z n | + ε b | n | ≤ | ( z n | + ) ε µ ≤ (1 + ε 2 ) µ z | n | . This provides a lower bound for | z n | in terms of | a n +1 | that can be substituted into i ) to prove iii ). glyph[square]

As with classical continued fractions, if | q qz ( -p ) | is sufficiently small for p, q ∈ O , then p/q appears as a convergent in the expansion of z . This property is interesting in our case because we are not specifying any particular method for choosing among multiple pairs a, b passing the if condition in line 5. As such, the following lemma asserts that finding sufficiently good approximations is unavoidable.

glyph[negationslash]

Lemma 3.8. Let p, q ∈ O with q = 0 and z = p/q . Take n ≥ -1 to be the smallest index for which glyph[negationslash]

$$| q _ { n + 1 } | \geq \sqrt { \frac { | q | \mu } { | q z - p | ( 1 - \varepsilon ^ { 2 } ) } },$$

or, if no such index exists, take n so that p n /q n = z . Then there exist a, b ∈ O with

$$| b | < 2 \sqrt { \frac { | q ( q z - p ) | \mu } { ( 1 - \varepsilon ^ { 2 } ) } }$$

satisfying p = ( ap n + bp n -1 ) /b n and q = ( aq n + bq n -1 ) /b n . In particular, p/q = p n /q n whenever | q qz ( -p ) | ≤ (1 -ε 2 ) / 4 µ .

Proof. For a given n , the value of b ∈ O that makes p = ( ap n + bp n -1 ) /b n and q = ( aq n + bq n -1 ) /b n for the right choice of a ∈ O is b = p n q -pq n .

First suppose there exists an index for which (3.4) holds, and let n be the smallest. The first inequality below is the triangle inequality, the second is Theorem 3.7a ii ), and the third comes from | q n +1 | satisfying (3.4) but | q n | violating (3.4) by minimality of n :

$$| b | = | p _ { n } q - p q _ { n } | \leq | q _ { n } ( q z - p ) | + | q ( q _ { n } z - p _ { n } ) | <$$

$$| q _ { n } ( q z - p ) | + \left | \frac { q } { q _ { n + 1 } } \right | \frac { \mu } { ( 1 - \varepsilon ^ { 2 } ) } < 2 \sqrt { \frac { | q ( q z - p ) | \mu } { ( 1 - \varepsilon ^ { 2 } ) } }.$$

If (3.4) is never satisfied then z must be rational because otherwise Proposition 3.2 implies continuants grow without bound. By Corollary 3.4 we we can choose n with p n /q n = z . The assumption that | q n | does not satisfy (3.4) bounds it from above. We use this upper bound for the inequality below:

$$| b | = | p _ { n } q - p q _ { n } | = \left | \frac { q _ { n } } { q } \right | | q ( q z - p ) | < \sqrt { \frac { | q ( q z - p ) | \mu } { ( 1 - \varepsilon ^ { 2 } ) } }.$$

For the last claim, combining | q qz ( -p ) | ≤ (1 -ε 2 ) / 4 µ with the upper bound on b in the statement of the lemma forces | b | &lt; 1. Thus b = 0, implying p/q = ( ap n /b n ) / aq ( n /b n ) = p n /q n as claimed. glyph[square]

glyph[negationslash]

Theorem 3.9. If p/q is not a convergent of z for some p, q ∈ O with q = 0 , then

$$| q _ { n } ( q _ { n } z - p _ { n } ) | < \frac { 4 \varepsilon \mu ^ { 2 } | q ( q z - p ) | } { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } }$$

for any n ≥ 1 . That is, each p n /q n is a best approximation of the second kind up to constants: if rs ≤ (1 -ε 2 ) 2 / 4 εµ 2 , then 0 &lt; q &lt; r q | | | n | implies | qz - | p &gt; s q | n z -p n | for any p ∈ O except perhaps when p/q is already a convergent.

Proof. Violating the stated inequality combines with Theorem 3.7a i ), giving

$$| q ( q z - p ) | \leq \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | q _ { n } ( q _ { n } z - p _ { n } ) | } { 4 \varepsilon \mu ^ { 2 } } < \frac { 1 - \varepsilon ^ { 2 } } { 4 \mu }.$$

Thus p/q is a convergent by Lemma 3.8.

glyph[square]

3.2. Continuants. Here we study the growth of | q n | , which may not be monotonic as the example in Subsection 2.3 demonstrates.

glyph[negationslash]

Lemma 3.10. Suppose B and ε are admissible and that µ = 1 or | ∆ = 3 | . Then εµ ≥ 2 3 / .

glyph[negationslash]

Proof. Let z ∈ R approach ε from the right. Every nonzero element of O has magnitude at least 1, so no nonzero multiple of z is within ε of 0. In particular, the minimal nonzero multiple of z that is within ε of any integer is glyph[ceilingleft] 1 /ε - glyph[ceilingright] 1 z . So µ ≥ glyph[ceilingleft] 1 /ε - glyph[ceilingright] 1 , which is at least 2 / 3 ε unless ε ∈ [1 / 2 2 , / 3). In this range, εµ &lt; 2 / 3 would imply µ &lt; 4 / 3. This forces B to consist of units since non-units in imaginary quadratic rings have magnitude at least √ 2. Thus the discs in Definition 2.4's union are centered on integers. But discs of radius ε ∈ [1 / 2 2 , / 3) on integers only cover the plane when ∆ = -3. glyph[square]

Theorem 3.11. If 0 ≤ n &lt; n ′ , then

$$| q _ { n } | > \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | q _ { n ^ { \prime } } z _ { n ^ { \prime } } | } { 4 \varepsilon ^ { n - n ^ { \prime } } \mu ^ { 2 } }.$$

In particular, if

n

≥

1

then

|

q

n

|

&gt;

(1

-

ε

2

)

2

/

4

ε

n

µ

2

.

Proof. Since q 0 = 0, we may assume that n ′ ≥ 1. Suppose the first lower bound on | q n | is false. Then by Proposition 3.2 and Theorem 3.7a i ),

$$| q _ { n } ( q _ { n } z - p _ { n } ) | < \varepsilon ^ { n - n ^ { \prime } } | q _ { n } ( q _ { n ^ { \prime } } z - p _ { n ^ { \prime } } ) | \leq \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | q _ { n ^ { \prime } } z _ { n ^ { \prime } } ( q _ { n ^ { \prime } } z - p _ { n ^ { \prime } } ) | } { 4 \mu ^ { 2 } } < \frac { 1 - \varepsilon ^ { 2 } } { 4 \mu }.$$

Therefore Lemma 3.8 applies, and either p n /q n = z or n = n ′′ , where n ′′ is the first index (recall convergents cannot repeat by Corollary 3.3) for which

$$| q _ { n ^ { \prime \prime } + 1 } | \geq \sqrt { \frac { | q _ { n } | \mu } { | q _ { n } z - p _ { n } | ( 1 - \varepsilon ^ { 2 } ) } }.$$

Regarding the second possibility, | q n -1 | must fail to satisfy the bound above in place of | q n ′′ +1 | . Thus

$$1 \leq | p _ { n } q _ { n - 1 } - p _ { n - 1 } q _ { n } | \leq | q _ { n } ( p _ { n - 1 } - q _ { n - 1 } z ) | + | q _ { n - 1 } ( q _ { n } z - p _ { n } ) |$$

$$< \frac { \varepsilon ^ { n - n ^ { \prime } } | q _ { n } ( q _ { n ^ { \prime } } z - p _ { n ^ { \prime } } ) | } { \varepsilon } + \sqrt { \frac { | q _ { n } ( q _ { n } z - p _ { n } ) | \mu } { 1 - \varepsilon ^ { 2 } } } < \frac { 1 - \varepsilon ^ { 2 } } { 4 \varepsilon \mu } + \frac { 1 } { 2 } < 1.$$

The last inequality uses Lemma 3.10. The same contradiction occurs in the case p n /q n = z ; we just get to replace the summand | q n -1 ( q n z -p n ) | above with 0. Finally, | q n | &gt; (1 -ε 2 ) 2 / 4 ε n µ 2 uses n ′ = 1 and | q n ′ z n ′ | ≥ 1 · 1 /ε . glyph[square]

Corollary 3.12. If n ≥ 1 , then

$$\left | z - \frac { p _ { n } } { q _ { n } } \right | < \frac { 4 \varepsilon ^ { 2 n } \mu ^ { 2 } } { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } }.$$

Proof. This follows from | q n | &gt; (1 -ε 2 ) 2 / ε 4 n µ 2 and | q n z -p n | ≤ ε n . glyph[square]

3.3. Coefficients. Here we show that the existence of an infinite, periodic sequence of coefficients for an input z is equivalent to [ K z ( ) : K ] = 2, and that boundedness of coefficients is equivalent to z being badly approximability. Both are true whether 'coefficient' is interpreted to mean a n , a n /b n , or the pair a n , b n , and there is little difference made to the proofs.

glyph[negationslash]

Definition 3.13. We call z ∈ C badly approximable if | q qz ( -p ) | has a positive infimum over p, q ∈ O with q = 0. Otherwise, z is well approximable .

To prove that bad approximability is equivalent to bounded coefficients, we need a lower-bound analogue of Theorem 3.7a iii ).

Lemma 3.6b. If n ≥ 1 then

$$\left | 1 + \frac { q _ { n - 1 } } { q _ { n } z _ { n } } \right | < \frac { 4 \varepsilon ^ { 2 } \mu ^ { 2 } } { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } }.$$

Proof. First we use Theorem 3.11 with n ′ = n -1 to get

$$| q _ { n } | > \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | q _ { n - 1 } z _ { n - 1 } | } { 4 \varepsilon \mu ^ { 2 } } \geq \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | q _ { n - 1 } | } { 4 \varepsilon ^ { 2 } \mu },$$

which bounds | q n -1 /q n | from above. Along with 1 / z | n | &lt; ε and the triangular inequality, this shows

$$\left | 1 + \frac { q _ { n - 1 } } { q _ { n } z _ { n } } \right | < 1 + \frac { 4 \varepsilon ^ { 3 } \mu ^ { 2 } } { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } }.$$

The right-hand side above is less than the stated bound precisely when εµ exceeds (1 -ε 2 ) / 2 √ 1 -ε , which attains a maximum of 2 √ 6 / 9 at ε = 1 3. By Lemma 3.10, / εµ ≥ 2 3 / &gt; 2 √ 6 / 9. glyph[square]

Theorem 3.7b. If n ≥ 1 then | q n z -p n | is greater than

$$i ) \ \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | b _ { n } | } { 4 \varepsilon ^ { 2 } \mu ^ { 2 } | q _ { n } z _ { n } | }, \quad i i ) \ \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | b _ { n + 1 } | } { 4 \varepsilon ^ { 2 } \mu ^ { 2 } | q _ { n + 1 } | }, \quad a n d \quad i i i ) \ \frac { ( 1 - \varepsilon ^ { 2 } ) ^ { 2 } | b _ { n + 1 } | } { 8 \varepsilon ^ { 2 } \mu ^ { 2 } | a _ { n + 1 } q _ { n } | }.$$

Proof. Lemma 3.6b combines with identities (3.2) and (3.3) to prove i ) and ii ) directly, just as in the proof of Theorem 3.7a.

For iii ), | b n +1 z n -a n +1 | ≤ | ε b n | implies | b n +1 z n | ≤ | a n +1 | + ε b | n | . Dividing both sides of this last inequality by | a n +1 b n | gives

$$\left | \frac { b _ { n + 1 } z _ { n } } { a _ { n + 1 } b _ { n } } \right | \leq \frac { 1 } { | b _ { n } | } + \frac { \varepsilon } { | a _ { n + 1 } | } \leq 2.$$

Now scale both ends of the inequality above by | b n / 2 z n | to get the lower bound for | b n /z n | that turns i ) into iii ). glyph[square]

Corollary 3.14. An input z is badly approximable if and only ( a n /b n n ) is bounded.

Proof. If z is badly approximable then ( a n n ) (and thus ( a n /b n n ) ) is bounded by Theorem 3.7a iii ). If z is well approximable then sufficiently good approximations appear as convergents by Theorem 3.9, implying ( a n /b n n ) is unbounded by Theorem 3.7b iii ). glyph[square]

Finally, we prove the existence of periodic expansions of quadratic, irrational inputs.

Theorem 3.15. The set { z n } n is finite if and only if [ K z ( ) : K ] ≤ 2 . In particular, z has a continued fraction expansion in which the sequence of pairs ( a n , b n n ) is eventually periodic and infinite if and only if [ K z ( ) : K ] = 2 .

Proof. If { z n } n is finite and ( z n n ) is not then there are distinct n, n ′ ∈ N with M -1 n ( z ) = z n = z n ′ = M -1 n ′ ( z ). By Corollary 3.3, M n cannot be a scaled copy of M n ′ . Thus M M n ′ -1 n ( z ) = z shows that z satisfies a quadratic (irreducible by Corollary 3.4) polynomial with coefficients in K .

For the converse, suppose [ K z ( ) : K ] = 2. Let x denote the discriminant of an integral, quadratic polynomial of which z is a root, and use the quadratic formula to write z = ( w + ) x /y such that w,y, ( x 2 -w 2 ) /y ∈ O . Let us also get an expression for z n in terms of w , x and y . The last equality below comes from rationalizing the denominator with respect to the quadratic irrational x . That is, we multiply numerator and denominator by the conjugate of the denominator.

$$\mu _ { 1 / \varepsilon \vee } \, \mu _ { n - 1 } z - p _ { n - 1 } \, = \, ( q _ { n - 1 } w - p _ { n - 1 } y ) + q _ { n - 1 } x \, \mu _ { n - 1 }$$

$$z _ { n } = M _ { n } ^ { - 1 } ( z ) = \frac { q _ { n - 1 } z - p _ { n - 1 } } { p _ { n } - q _ { n } z } = \frac { ( q _ { n - 1 } w - p _ { n - 1 } y ) + q _ { n - 1 } x } { ( p _ { n } y - q _ { n } w ) - q _ { n } x } = \\ \frac { \left ( q _ { n - 1 } q _ { n } ( x ^ { 2 } - w ^ { 2 } ) / y - p _ { n - 1 } p _ { n } y + w ( p _ { n } q _ { n - 1 } + q _ { n } p _ { n - 1 } ) \right ) + ( - 1 ) ^ { n } b _ { n } x } { \left ( ( p _ { n } y - q _ { n } w ) ^ { 2 } - q _ { n } ^ { 2 } x ^ { 2 } \right ) / y }. \quad ( 3. 5 ) \\ \tau \sim \sim - \int \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimits \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nulimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nolimis \nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim\nodim$$

Let x n = ( -1) n b n x , giving x 2 n ∈ O . Define w n and y n using the expression above so that ( w n + x n ) /y n = z n . As y divides x 2 -w 2 , w n and y n are seen from (3.5) to be integers.

Now we find recursive expressions for w n , x n , and y n using the recursive formula for z n in Proposition 2.7. The final equality is again rationalizing the denominator.

$$\infty \, \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, \ m a \, \colon \, \text{$\rho$ovo} \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \tilde { \tau } _ { n } \, $ \ t } _ { n } \, = \\ \frac { \left ( ( b _ { n } w _ { n - 1 } - a _ { n } y _ { n - 1 } ) / b _ { n - 1 } \right ) - b _ { n } x _ { n - 1 } / b _ { n - 1 } } { \left ( ( b _ { n } w _ { n - 1 } - a _ { n } y _ { n - 1 } ) ^ { 2 } - b _ { n } ^ { 2 } x _ { n - 1 } ^ { 2 } \right ) / b _ { n - 1 } ^ { 2 } y _ { n - 1 } }. \\ \text{Note that $-h$} \, \ r \quad \cdot / h \quad \cdot = - h \, \ l ( - 1 ) ^ { n - 1 } h \quad \cdot \ r \rangle / h \quad \cdot = ( - 1 ) ^ { n } h \quad \ r \ t h s \ m a t h i n g$$

Note that -b n x n -1 /b n -1 = -b n ( ( -1) n -1 b n -1 x /b ) n -1 = ( -1) n b n x , thus matching a pair of terms from (3.5) and (3.6). But { 1 , x } is a basis for the field extension K z /K ( ) . So because the remaining terms in (3.5) and (3.6) belong to K , there is only one way they could match up:

$$w _ { n } = \frac { b _ { n } w _ { n - 1 } - a _ { n } y _ { n - 1 } } { b _ { n - 1 } } \quad \text{and} \quad y _ { n } = \frac { ( b _ { n } w _ { n - 1 } - a _ { n } y _ { n - 1 } ) ^ { 2 } - b _ { n } ^ { 2 } x _ { n - 1 } ^ { 2 } } { b _ { n - 1 } ^ { 2 } y _ { n - 1 } }.$$

These recursive formulas for w n and x n give the second equality below:

$$\frac { 1 } { \varepsilon } \left | \frac { y _ { n } } { y _ { n - 1 } } \right | \leq \left | \frac { y _ { n } z _ { n } } { y _ { n - 1 } } \right | = \left | \frac { w _ { n } + x _ { n } } { y _ { n - 1 } } \right | = \left | \frac { b _ { n } z _ { n - 1 } - a _ { n } } { b _ { n - 1 } } + \frac { ( - 1 ) ^ { n } 2 b _ { n } x } { y _ { n - 1 } } \right | \leq \varepsilon + \frac { 2 \mu | x | } { | y _ { n - 1 } | }.$$

Thus | y n | ≤ ε 2 | y n -1 | +2 εµ x | | , implying ( y n n ) is a bounded sequence. Therefore

$$| w _ { n } | = \left | \frac { b _ { n } w _ { n - 1 } - a _ { n } y _ { n - 1 } } { b _ { n - 1 } } \right | = \left | \frac { y _ { n - 1 } ( b _ { n } z _ { n - 1 } - a _ { n } ) } { b _ { n - 1 } } + ( - 1 ) ^ { n } b _ { n } x \right | \leq \varepsilon | y _ { n - 1 } | + \mu | x |$$

shows that ( w n n ) is also bounded. Since w n , x 2 n , and y n are all bounded integers, { z n } n = ( { w n + x n ) /y n } n is finite.

To see why the final periodicity claim follows, fix an expansion of a quadratic irrational z . By finiteness of B and { z n } n , there are indices n &gt; n ′ with z n ′ = z n , b n ′ = b n , and M n ′ ≡ M n mod b n . For any matrix S , if either of M S n or M S n ′ has integer entries then b n S = det M S n = det M S n ′ does too, implying both M S n and M S n ′ have integer entries. This shows that ( M S n ) glyph[lscript] is ε -reduced if and only if ( M S n ′ ) glyph[lscript] is ε -reduced. Thus we may take a k ′ = a k and b k ′ = b k for all k ′ &gt; n ′ , where k ′ ≡ k mod( n ′ -n ) for n &lt; k ≤ n ′ . glyph[square]

glyph[negationslash]

Figure 4 shows { z n } n for z = (3 + 5 ) i / 4 using B = { 1 } in Q ( √ -11). The covering is centered at 0 ∈ C , and z is labeled '0.' As it lies in both the yellow disc centered at (1 + √ -11) / 2 and the blue disc centered at (3 + √ -11) / 2, there are two possibilities for a 1 . The resulting values of z 1 are indicated by the yellow and blue arrows to 1 and 7 in the diagram, and are labeled '1' and '7' in the image. In particular, numbers in the figure need not correspond to the stage number at which a point might appear.

We remark that aside from being overly complicated, the proof of Theorem 3.15 applies to the continued fractions produced when Algorithm 1 is executed over Z . The author is not aware of such a perspective (absent of a fixed convention for selecting among multiple coefficients) in the literature. Even with B = { 1 } , there are overlapping discs (intervals in this case) that allow for an infinite number of periodic continued fraction expansions, all of which converge to the given quadratic, irrational input. By taking B = { 1 } , our algorithm finds the additional use over Z of producing even more such expansions. It is possible, however, that these expansions are already obtainable by altering nearest integer coefficients with the processes of singularization and expansion [8].

Figure 4. Left: { z n } n for input z 0 = (3 + 5 ) i / 4 and | ∆ = 11. Right: result | from using the disc of indicated color.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-c089dff1-54dd-4b4e-8cf4-2f86c57a40d1.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-81f0b07b-734c-4220-b8c7-fa8bf3be620b.jpg)

↦

↦

It is not generally the case that if z n appears in a continued fraction expansion then -z n will also appear, but it does happen in this example for every point except z 0 = z . This fact has been used to cut the number of nodes needed for our diagram in half. Dashed arrows indicate a sign switch. For example, consider the point labeled ' -4,' which is only contained in the disc centered on -1. Its image under z → √ 1 / z ( - -( 1)) is '5,' not ' -5.' Similarly, '2' is mapped by z → 1 / z ( -(1 --11) / 2) to ' -3.'

## 4. Admissible parameters

The coverings provided by Definition 2.4 are indexed by ideals rather than the matrices used in line 5. Let us check that our notion of admissibility is sufficient for Algorithm 1 to function, meaning a and b satisfying lines 4 and 5 always exist.

Lemma 4.1. For M,M ′ ∈ GL ( 2 K ) , if M is integral then ( MM ′ ) glyph[lscript] ⊇ det M M ( ′ ) glyph[lscript] . Proof. The adjugate of M , adj M = M -1 det M , is also integral. So det M M ( ′ ) glyph[lscript] = ((adj M MM ) ′ ) glyph[lscript] ⊆ ( MM ′ ) . glyph[lscript] glyph[square]

Proposition 4.2. The if condition in line 5 of Algorithm 1 is satisfied at least once every outer for loop iteration.

Proof. Let M with det M = b ′ ∈ B be a matrix that occurs in the execution of Algorithm 1. Since M is either the identity or the matrix product from line 5 in the previous outer for loop iteration, ( M ) glyph[lscript] is ε -reduced. Denote this ideal b , as that is the role it will play in Definition 2.4.

Fix any a ′ in the fractional ideal b -1 that makes ( MS a , ( ′ 1)) glyph[lscript] = b ′ b -1 . According to Definition 2.4, for any z ∈ C there exist a ∈ K and b ∈ B for which ( a , b b b -1 ) is integral and ε -reduced and ( M -1 ( z ) -a ′ ) /b ′ ∈ D a/b, ε/ b ( | | ). This disc containment rearranges to ab ′ + a b ′ ∈ D bM ( -1 ( z , ε b ) | ′ | ) as in line 4. Note that b , b ′ ∈ b implies ab ′ + a b ′ ∈ O . So our proposed choice of coefficient pair is ab ′ + a b ′ and b . It remains only to check that ( MS ab (( ′ + a b /b , b/b ′ ) ′ ′ )) glyph[lscript] is ε -reduced. We claim that this ideal is exactly ( a , b b b -1 ), which would complete the proof.

Let p be an unramified prime in the ideal class of b that does not divide ab b , and let k ∈ K be a generator for pb -1 . Consider the product

$$M \begin{bmatrix} 1 & a ^ { \prime } \\ 0 & 1 \end{bmatrix} \begin{bmatrix} k & 0 \\ 0 & \| \mathfrak { p } \| / k b ^ { \prime } \end{bmatrix} \begin{bmatrix} \| \mathfrak { p } \| / k b ^ { \prime } & 0 \\ 0 & k \end{bmatrix} S ( a b ^ { \prime }, b ) = \frac { \| \mathfrak { p } \| } { b ^ { \prime } } M S ( a b ^ { \prime } + a ^ { \prime } b, b ). \quad ( 4. 1 )$$

We chose a ′ so that the product of the first two matrices has right-column ideal b ′ b -1 and left-column ideal b . In particular, the product of the first three matrices, call this M ′ , has determinant ‖ p ‖ , with ( M ′ ) glyph[lscript] = p and ( M ′ ) r = p . The product of the last two matrices on the left-hand side has top-left entry a ‖ p ‖ /k , which generates a bp , and bottom-left entry bk , which generates b pb -1 . Thus the left-column ideal of the product of all five matrices is contained in (( M ′ ) glyph[lscript] a bp , ( M ′ ) r b pb -1 ) = ‖ p ‖ ( a , b b b -1 ). On the other hand, since M ′ is integral, Lemma 4.1 says that the leftcolumn ideal of the overall product contains det M a ′ ( ‖ p ‖ /k, bk ) = ‖ p ‖ ( a bp , b pb -1 ). Since p is coprime to a bp and p is coprime to b pb -1 , we have ‖ p ‖ ( a bp , b pb -1 ) = ‖ p ‖ ( a , b b b -1 ), which must then equal the left-column ideal of the overall product. Comparing to the right-hand side of (4.1) proves our claim. glyph[square]

4.1. Generic admissible sets. The following result confirms the main assertion of this paper: Algorithm 1 works in any imaginary quadratic field. The admissible set { 1 2 , , ..., ⌊√ | ∆ | ⌋} is highlighted because it makes decent constants in the previous section's results. A few such constants can be seen in Theorems 1.2, 1.3, and 1.4.

Theorem 4.3. If µ ∈ Z with µ ≥ ⌊ √ | ∆ 3 | / ⌋ , then { 1 2 , , ..., µ } is admissible with

$$\varepsilon = \frac { 1 } { 2 } \sqrt { 1 + \frac { | \Delta | } { ( \mu + 1 ) ^ { 2 } } }$$

√

glyph[negationslash]

provided 2 ε µ &lt; 2 √ | ∆ | . In particular, { 1 2 , , ..., ⌊√ | ∆ | ⌋} is admissible with 1 / 2 . Proof. Fix z ∈ C and b ⊆ O with b ∩ B = ∅ . We will show that z is contained in Definition 2.4's union.

Let b 1 ∈ b ∩ B be minimal, implying the integral ideal b 1 b -1 has no nontrivial rational divisors. By Dirichlet's approximation lemma, the real number 2 b 2 1 glyph[Ifractur] ( z / ) √ | ∆ admits a rational approximation | a /b 2 2 for coprime a , b 2 2 ∈ Z with 1 ≤ b 2 ≤ glyph[floorleft] µ/b 1 glyph[floorright] and

$$\left | \frac { 2 b _ { 1 } ^ { 2 } \Im ( z ) } { \sqrt { | \Delta | } } - \frac { a _ { 2 } } { b _ { 2 } } \right | \leq \frac { 1 } { b _ { 2 } ( \lfloor \mu / b _ { 1 } \rfloor + 1 ) }.$$

Scaling both sides above by b 2 √ | ∆ 2 | / b 1 is the first inequality below; the second inequality uses the fact that µ -b 1 glyph[floorleft] µ/b 1 glyph[floorright] , which is a rational integer less than b 1 , is at most b 1 -1:

$$\dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \delta$$

Since b 1 b -1 has no nontrivial rational divisors, there is a congruence class modulo 2 ‖ b 1 b -1 ‖ (in Z ) whose elements, call one a 1 , satisfy ( a 1 + a 2 √ | ∆ ) | / 2 ∈ b 1 b -1 . Choose such an a 1 nearest to 2 b 2 1 b 2 glyph[Rfractur] ( z ). Then

$$\dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \dots \\ \left | b _ { 1 } b _ { 2 } z - \frac { a _ { 1 } + a _ { 2 } \sqrt { \Delta } } { 2 b _ { 1 } } \right | \leq \sqrt { \frac { \| b _ { 1 } \mathfrak { b } ^ { - 1 } \| ^ { 2 } } { 4 b _ { 1 } ^ { 2 } } } + \frac { | \Delta | } { 4 ( \mu + 1 ) ^ { 2 } } \leq \varepsilon. \quad \quad ( 4. 4 )$$

Thus z ∈ D a/b, ε/ b ( | | ), where a = ( a 1 + a 2 √ ∆) 2 / b 1 and b = b 1 b 2 ∈ B .

Assume by way of contradiction that ( a , b b b -1 ) is not ε -reduced. From Definition 2.2, this means k a ( b , b b -1 ) ⊆ O for some k ∈ K with 0 &lt; k | | ≤ ε 2 . Then the assumption 2 ε µ &lt; 2 √ | ∆ gives | | k b | ≤ ε µ &lt; 2 √ | ∆ 2. | / Thus kb ∈ Z because a non-rational integer must have magnitude at least √ | ∆ 2. | / By writing k ∈ Q in lowest terms, we see that k a ( b , b b -1 ) ⊆ O implies ( a , b b b -1 ) has a nontrivial rational divisor. Finally, a b = ( b /b 1 )( a 1 + a 2 √ | ∆ ) | / 2 glyph[owner] ( a 1 + a 2 √ | ∆ ) 2 shows | / that a rational divisor of a b must divide a 2 , and b b -1 = ( b 1 b -1 ) b 2 shows that a rational divisor of b b -1 must divide b 2 (recalling that b 1 b -1 has no nontrivial rational divisors). But a 2 and b 2 are coprime. glyph[square]

The second paragraphs in the proofs of Proposition 4.2 and Theorem 4.3 are algorithmic in nature. Combining them gives a fast method for finding coefficients.

Algorithm 2. Subroutine for Algorithm 1 to find coefficients ( a n and b n ) under the parameters B and ε defined in Theorem 4.3.

glyph[negationslash]

```
\text{Algorithm $z$. Subroutine for Algorithm 1 to nnd coefficients (a _ { n } and b _ { n } ) under} \text{the parameters $d.3$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\uint$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\uint$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\long$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\long$,} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$,} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\long$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\ int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\ int$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\string$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\string$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\float$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\float$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\left$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\left$.} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$}
\text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$}\text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$} \text{$\int$}
```

Let us collect notation that has been used thus far. Both Algorithm 2 and the proof of Proposition 4.2 begin with b ′ = det M and b = ( M ) glyph[lscript] (which is ( M n -1 ) glyph[lscript] = ( p n -1 , q n -1 ) if Algorithm 2 is returning a n and b n ). Both also use ab ′ + a b ′ and b to denote the coefficient pair returned to Algorithm 1. Then Algorithm 2 and the proof of Theorem 4.3 further break these variable down into a = ( a 1 + a 2 √ | ∆ ) | / 2 b 1 and b = b 1 b 2 . This notation is used throughout the remainder of the subsection.

Corollary 4.4. Under parameters B and ε as defined in Theorem 4.3, the coefficients produced by Algorithm 2 satisfy lines 4 and 5 of Algorithm 1.

Proof. Algorithm 2 is pseudocode for the second paragraph in the proof of Theorem 4.3. The only difference is that ' z ' in Theorem 4.3 is ( M -1 ( z ) -a ′ ) /b ′ in Algorithm 2. This substitution for z makes (4.4) equivalent to ab ′ + a b ′ ∈ D bM ( -1 ( z , ε b ) | ′ | ) as required by line 4 of Algorithm 1.

Regarding line 4 of Algorithm 2, floor function continued fractions return all a /b 2 2 for which | b 2 (2 glyph[Ifractur] ( z / ) √ | ∆ ) | -a 2 | is minimal without increasing b 2 . So because there exists an approximation satisfying (4.3), line 4 of Algorithm 2 finds it.

In the proof of Proposition 4.2 we saw that ( MS ab (( ′ + a b /b , b/b ′ ) ′ ′ )) glyph[lscript] = ( a , b b b -1 ). The third paragraph of the proof of Theorem 4.3 shows that ( a , b b b -1 ) is ε -reduced. Thus the coefficients returned by Algorithm 2 satisfy line 5 of Algorithm 1. glyph[square]

As discussed in Section 1, two advantages to using Algorithm 2 are speed and control over the divisors of ( p n -1 , q n -1 , p n , q n ).

Theorem 4.5. If a n -1 , b n -1 , a n , and b n are found using Algorithm 2, then only ramified, non-rational primes divide ( p n -1 , q n -1 , p n , q n ) .

Proof. The last paragraph of the proof of Theorem 4.3 shows that ( M n -1 ) glyph[lscript] = b has no nontrivial rational divisors if a n -1 and b n -1 are chosen using Algorithm 2. Therefore b 1 defined in line 2 is just ‖ b ‖ . We have seen that ( p n , q n ) = ( a , b b b -1 ), so the goal is to verify that ( b , a b , b b -1 ) has no split prime divisors.

Suppose p divides b but p does not. Then p divides b b -1 = b 2 b if and only if it divides b 2 . Similarly, p divides a b = ( a 1 + a 2 √ ∆) 2 / b if and only if it divides ( a 1 + a 2 √ ∆) 2. But this is true if and only if / ‖ p ‖ divides a 2 , because the choice of a 1 in line 5 gives ( a 1 + a 2 √ ∆) 2 / ∈ b ⊆ p . Thus gcd( a , b 2 2 ) = 1 implies p does not divide ( a , b b b -1 ) as desired. glyph[square]

glyph[negationslash]

We gauge the efficiency of Algorithms 1 and 2 by time required to find p, q ∈ O with q = 0 satisfying | qz -p | &lt; 1 /δ for some approximation quality goal δ . To make input length well-defined, the usual z ∈ C is replaced with z ∈ K . Then log | wxy ∆ can be taken as the input length of | z = ( w + x √ ∆) /y , where w,x,y ∈ Z and gcd( w,x,y ) = 1.

glyph[negationslash]

Theorem 4.6. Let z have input length glyph[lscript] and let δ ≥ 2 . By using Algorithm 2 to compute coefficients, Algorithm 1 can be executed in O (log | ∆ log | ε δ ) operations on integers of length O glyph[lscript] ( +log δ | ∆ ) | to find p, q ∈ O with q = 0 and | qz - | ≤ p 1 /δ .

Proof. To achieve | qz - | ≤ p 1 /δ , at most glyph[ceilingleft] log 1 /ε δ glyph[ceilingright] outer for loop iterations are needed by Proposition 3.2. Let us determine the cost of Algorithm 2.

Fix inputs for Algorithm 2. Consider the four-element generating set (over Z ) for b = ( M ) glyph[lscript] consisting of the products of left-column entries of M with a Z -basis for O . Reduce them mod b ′ . By computing greatest common divisors among the rational integers defining the real parts and imaginary parts of these four generators, it is straightforward to reduce our set to a Z -basis for b in O (log b ′ ) operations. Once we have this basis, line 1 is a matter of solving a system of two inhomogeneous congruences, which also requires O (log b ′ ) operations for the Euclidean algorithm.

As we are assuming Algorithm 2 was used on the previous for loop iteration, b has no nontrivial rational divisors. Thus b 1 = ‖ b ‖ , the determinant of the two-bytwo matrix with columns coming from our two-element Z -basis for b . So lines 2 and 3 both take O (1) operations.

Using classical continued fractions for line 4 requires O (log( µ/b 1 )) operations.

Line 5 requires computing the appropriate congruence class for a mod2 ‖ b ‖ , (The factor of 2 in the modulus comes from

1 since ( a 1 + a 2 √ | ∆ ) | / 2 ∈ b 1 b -1 = b . the general constraint a 1 ≡ a 2 ∆mod2.) This requires O (log ‖ b ‖ ) operations.

So at worst, a line in Algorithm 2 requires O (log µ ) operations. The inequality 2 ε µ &lt; 2 √ | ∆ from Theorem 4.3 along with the definition of | ε in (4.2) imply µ = O ( √ | ∆ ), giving the desired overall bound on operations of | O (log | ∆ log | ε δ ).

We turn to the bound on integer lengths. Let n be the first index for which | q n z -p n | ≤ 1 /δ . For n ′ ≤ n , Theorem 3.7a shows | a n ′ | = O δµ ( 2 ), | q n ′ | = O δµ ( ), and | z n ′ | = O δµ ( ) (except possibly z 0 ). Using | q n ′ z -p n ′ | &lt; 1 shows that | p n ′ | = O δµ z ( | | ). And finally, b n ′ ≤ µ . Computations involve a few of these variables within

each stage. Since the input length of an integer is determined by the logarithm of its magnitude, µ = O ( √ | ∆ ) completes the proof. | glyph[square]

4.2. Precomputing admissible sets. Table 2 shows admissible sets for | ∆ | &lt; 50 with their minimal ε -values. For each field we include the smallest admissible set B (measured by µ ), as well as the next smallest set which decreases the corresponding value of ε . We use τ to denote √ ∆ 2 or (1 + / √ ∆) 2 according to the parity of ∆. /

Table 2. Some small (measured by µ ) admissible sets with their minimal ε 2 .

|   | ∆ | | B                  | ε 2                                 |   23 | 1 , 2 1 , 2 , τ, τ         | 8 / 9 √                                      |
|---------|--------------------|-------------------------------------|------|----------------------------|----------------------------------------------|
|       3 | 1 1 , 1 + τ        | 1 / 3 1 / 4                         |   24 | 1 , 2                      | (31 - 161) / 25 √                            |
|       4 | 1 1 , 1 + τ        | 1 / 2 2 - √ 3                       |   24 | 1 , 2 , 1+ τ               | (11 - 6 2) / 3 (10 - √ 58) / 3 √             |
|       7 | 1 1 , τ            | 4 / 7 1 / 2                         |   31 | 1 , 2 , 3 1 , 2 , 3 , 1+ τ | (191 - 3 1209) / 128 20 / 31                 |
|       8 | 1 1 , τ            | 3 / 4 3 - √ 6                       |   35 | 1 , 2 , 3 1 , τ, τ, 1+ τ   | (211 - 3 √ 1505) / 128 (805 - 5 √ 25585) / 8 |
|      11 | 1 1 , τ            | 9 / 11 3 / 4                        |   39 | 1 , 2 , 3 1 , 2 , 3 , 1+ τ | (231 - 3 √ 1833) / 128 10 / 13               |
|      15 | 1 , 2 1 , 2 , 1+ τ | 2 / 3 (6 - 2 √ 5) / 3               |   40 | 1 , 2 , 3 1 , 2 , 3 , 2+ τ | 7 / 8 (25 - √ 185) / 16                      |
|      19 | 1 , 2 1 , τ, τ     | 7 / 9 (13 - √ 57) / 8               |   43 | 1 , 2 , 3 1 , 2 , 3 , 1+ τ | (251 - 3 √ 2193) / 128 391 / 477             |
|      20 | 1 , 2 1 , 2 , 1+ τ | (28 - 2 √ 115) / 9 (25 - √ 355) / 9 |   47 | 1 , 2 , 3 1 , 2 , 3 , 1+ τ | (271 - 3 √ 2585) / 128 42 / 47 2             |

The C ++ source code that produced Table 2 is posted on the author's website. The algorithm takes as input a discriminant and a finite set of integers. It returns all admissible subsets of the input alongside their minimal ε -values. In short, the algorithm works by enumerating ideals b from Definition 2.4 and computing the smallest ε for which ∪ D a/b, ε/ b ( | | ) = C . The covering property is checked by exploiting periodicity of the union modulo the fractional ideal b -2 , and verifying that intersections of the boundaries of two discs are contained in a third disc.

The admissible sets above which are contained in Z have already been found by Theorem 4.3. For ∆ = -4, -8, -15, -19, -23, and -40, the values of ε given in (4.2) are optimal, matching those of Table 2. This does not always happen, and Figure 5 gives one such example. Both images show the same arrangement of discs, coming from the first stage of Algorithm 1 using B = { 1 2 3 , , } in Q ( √ -47). There are discs of radius 1 /b along every multiple of the line glyph[Ifractur] ( z ) = √ 47 2 / b for b ∈ { 1 2 3 , , } . Up to scaling, shifting, and reflecting, there are two other disc arrangements also produced by B = 1 2 3 . The three colors in Figure 5 distinguish { , , } among which arrangement would appear in stage 2 (similar to colors in Figures 2 and 3).

The first image in Figure 5 shows the partition used by Algorithm 2 to determine a 1 and b 1 based on the location of z . Here radii can be scaled by ε = √ 63 8 before /

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-73cd3404-dfb3-4628-b2cb-e9dcb9a8543c.jpg)

Figure 5. In Q ( √ -47) using B = { 1 2 3 , , } , partitions resulting from Algorithm 2 (left) and minimizing | bz - | a (right).

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00121v4-figure-aeda9b9b-c37d-4b07-9bbf-e198c125b239.jpg)

disc boundaries and corresponding partition boundaries touch. This agrees with Theorem 4.3's value of ε in (4.2). The second image shows the partition that minimizes | b 1 z -a 1 | . Now discs can be scaled by the smaller

$$\varepsilon = \sqrt { \frac { 2 7 1 - 3 \sqrt { 2 5 8 5 } } { 1 2 8 } },$$

as Table 2 asserts.

↦

As an aside, such a partition associates to every z ∈ C a disc center a/b . We can then ask whether a probability measure exists on D (0 , ε ) for which z → ( b/z -a /b ) ′ is invariant and ergodic. For Hurwitz' algorithm, an invariant measure is shown to exist for Q ( √ -3) in [20], and Nakada does the same for Q ( √ -1) in [12]. Shiokawa also proves ergodicity results in [19] for Q ( √ -3). The goal of such an investigation is to attack statistical questions, like the distribution of coefficients or the expected value of | q n ( q n z -p n ) | for z uniformly distributed in D (0 , ε ).

## References

- [1] Maxwell Anselm and Steven H. Weintraub. A generalization of continued fractions. Journal of Number Theory , 131(12):2442-2460, 2011.
- [2] Edward B. Burger, Jesse Gell-Redman, Ross Kravitz, Daniel Walton, and Nicholas Yates. Shrinking the period lengths of continued fractions while still capturing convergents. Journal of Number Theory , 128(1):144-153, 2008.
- [3] Jeremy S. Bygott. Modular forms and modular symbols over imaginary quadratic fields . PhD thesis, University of Exeter, 1998.
- [4] S. G. Dani. Continued fraction expansions for complex numbers-a general approach. Acta Arithmetica , 171(4):355-369, 2015.
- [5] J¨rgen Elstrodt, Fritz Grunewald, and Jens Mennicke. u Groups acting on hyperbolic space: Harmonic analysis and number theory . Springer Science &amp; Business Media, 2013.

- [6] Doug Hensley. Continued fractions . World Scientific, 2006.
- [7] Adolf Hurwitz. ¨ ber U die Entwicklung complexer Gr¨ssen in Kettenbr¨che. o u Acta Mathematica , 11(1-4):187-200, 1887.
- [8] Cor Kraaikamp. A new class of continued fraction expansions. Acta Arithmetica , 57(1):1-39, 1991.
- [9] Richard B. Lakein. Approximation properties of some complex continued fractions. Monatshefte f¨r Mathematik u , 77(5):396-403, 1973.
- [10] Daniel E. Martin. The geometry of imaginary quadratic fields . PhD thesis, University of Colorado at Boulder, 2020.
- [11] Daniel E. Martin. Fundamental polyhedra of projective elementary groups. arXiv:2204.04790, 2022.
- [12] Hitoshi Nakada. On the Kuzmin's theorem for complex continued fractions. KEIO Engineering Reports , 29, 1976.
- [13] Nicola Oswald. Hurwitz's Complex Continued Fractions-A Historical Approach and Modern Perspectives . PhD thesis, Universit¨t W¨rzburg, 2014. a u
- [14] Gerardo Gonz´ alez Robert. Complex Continued Fractions: Theoretical Aspects of Hurwitzs Algorithm . PhD thesis, Aarhus University, 2018.
- [15] Asmus L. Schmidt. Diophantine approximation of complex numbers. Acta Mathematica , 134(1):1-85, 1975.
- [16] Asmus L. Schmidt. Diophantine approximation in the field Q ( i √ 11). Journal of Number Theory , 10(2):151-176, 1978.
- [17] Asmus L. Schmidt. Diophantine approximation in the Eisensteinian field. Journal of Number Theory , 16(2):169-204, 1983.

√

- [18] Asmus L. Schmidt. Diophantine approximation in the field Q ( i 2). Journal of Number Theory , 131(10):1983-2012, 2011.
- [19] Iekata Shiokawa. Some ergodic properties of a complex continued fraction algorithm. KEIO Engineering Reports , 29:73-86, 1976.
- [20] Iekata Shiokawa, Ryuji Kaneiwa, and Jun-Ichi Tamura. A proof of Perron's theorem on Diophantine approximation of complex numbers. KEIO Engineering Reports , 28:131-147, 1975.
- [21] Katherine E. Stange. Visualizing the arithmetic of imaginary quadratic fields. International Mathematics Research Notices , 2018(12):3908-3938, 2018.
- [22] Richard G. Swan. Generators and relations for certain special linear groups. Advances in Mathematics , 6(1):1-77, 1971.
- [23] Elise Whitley. Modular forms and elliptic curves over imaginary quadratic number fields . PhD thesis, University of Exeter, 1990.

Department of Mathematics, Mathematical Sciences Building, One Shields Avenue, University of California, Davis, CA, 95616

Email address : dmartin@math.ucdavis.edu
Daniel E. Martin
Continued fractions over non-Euclidean imaginary quadratic rings
We propose and study a generalized continued fraction algorithm that can be
executed in an arbitrary imaginary quadratic field, the novelty being a
non-restriction to the five Euclidean cases. Many hallmark properties of
classical continued fractions are shown to be retained, including exponential
convergence, best-of-the-second-kind approximation quality (up to a constant),
periodicity of quadratic irrational expansions, and polynomial time complexity.