                                                      RECIPROCITY OBSTRUCTIONS IN SEMIGROUP ORBITS IN SL(2, Z)

                                                                                 JAMES RICKARDS AND KATHERINE E. STANGE


                                                    Abstract. We study orbits of semigroups of SL(2, Z), and demonstrate reciprocity obstructions: we show
                                                    that certain such orbits avoid squares, but not as a consequence of obstructions inherited from an algebraic
arXiv:2401.01860v3 [math.NT] 23 Jan 2025




                                                    set, and not as a consequence of congruence obstructions. This is in analogy to the reciprocity obstructions
                                                    recently used to disprove the Apollonian local-global conjecture. We give an example of such an orbit
                                                    which is known exactly, and misses all squares together with an explicit finite list of sporadic values: the
                                                    corresponding semigroup is not thin, but is dense in an algebraic variety that does not have such obstructions.
                                                    We also demonstrate thin semigroups with reciprocity obstructions, including semigroups associated to
                                                    continued fractions formed from finite alphabets. Zaremba’s conjecture states that for continued fractions
                                                    with coefficients chosen from {1, . . . , 5}, every positive integer appears as a denominator. Bourgain and
                                                    Kontorovich proposed a generalization of Zaremba’s conjecture in the context of semigroups associated
                                                    to finite alphabets. We disprove their conjecture. In particular, we demonstrate classes of finite continued
                                                    fraction expansions which never represent rationals with square denominator, but not as a consequence of
                                                    congruence obstructions, and for which the limit set has Hausdorff dimension exceeding 1/2. An example
                                                    of such a class is continued fractions of the form [0; a1 , a2 , . . . , an , 1, 1, 2], where the ai are chosen from the
                                                    set {4, 8, 12, . . . , 128}. The object at the heart of these results is a semigroup Ψ ⊆ Γ1 (4) which preserves
                                                    Kronecker symbols.




                                                                                                        Contents
                                              1. Introduction                                                                                                                   1
                                              2. Statements of results                                                                                                          3
                                              3. Behaviour of the Kronecker symbol under Möbius transformation                                                                 8
                                              4. Sufficient conditions for integers to be represented by orbits of Ψ                                                           12
                                              5. Proof of Theorems 2.5 and 2.6                                                                                                 17
                                              6. An explicit orbit                                                                                                             20
                                              7. Subsemigroups of Ψ of Hausdorff dimension less than 1                                                                         20
                                              8. Obstructions in Ψ1 and Ψ2                                                                                                     23
                                              9. Connection to continued fractions                                                                                             25
                                              10. Subgroups of SL(2, Z) with reciprocity obstructions                                                                          27
                                              References                                                                                                                       27



                                                                                                   1. Introduction
                                              Let Γ ⊆ SL(d, Z) be a multiplicative semigroup, v ∈ Zd a primitive vector, and L : Zd → Z a primitive
                                           linear functional. We call Γv a semigroup orbit and study the set L(Γv) ⊆ Z of integers it represents.
                                           Of particular interest are thin orbits, which grow slowly, arising from semigroups which are too ‘small’ to
                                           inherit their behaviour from their Zariski closure. In analogy to the study of integer and rational points in

                                              Date: January 27, 2025.
                                              2020 Mathematics Subject Classification. Primary: 11A15, 14G12, 11J70. Secondary: 11A55.
                                              Key words and phrases. Thin semigroup, thin group, reciprocity obstruction, continued fraction, Zaremba’s conjecture,
                                           local-global conjecture, Hausdorff dimension.
                                              Rickards and Stange were supported by NSF-CAREER CNS-1652238 (PI Katherine E. Stange); Stange was also supported
                                           by NSF DMS-2401580. This work utilized the Alpine high performance computing resource at the University of Colorado
                                           Boulder. Alpine is jointly funded by the University of Colorado Boulder, the University of Colorado Anschutz, and Colorado
                                           State University.
                                                                                                               1
Diophantine geometry, we study the arithmetic of these orbits. Observed obstructions to integers n appearing
in L(Γv) for Γ a thin semigroup could be classified as follows:
    (1) Definiteness: the orbit may only represent integers above or below a certain cutoff. This occurs for
        Apollonian circle packings; see also [BK10, Section 1.2] for an example in SL(2, Z).
    (2) Counting: the number of vectors in an orbit of size up to N is typically asymptotic to cN ν for some
        positive constants c, ν; for ν < 1 it is not possible to represent all integers. See [Kon13] for many
        examples.
    (3) Congruence: numbers from a congruence class a (mod m) may not be represented by the orbit. In
        the case of Apollonian circle packings, m = 24 describes such obstructions. See [BK14b, pp. 2-3] for
        an example in GL(2, Z).
    (4) Inherited: we include in this category any obstruction which exists for the integral or rational points
        of an algebraic set containing the orbit. For example, the Zariski closure may be an algebraic group
        with obstructions inherited by its subgroups and subsemigroups; an example with Brauer-Manin
        obstruction is mentioned in [KZ23, p. 5]. Variations on this theme include integral Brauer-Manin
        obstructions such as spinor exceptions for quadratic forms [SP80]. In this paper, the Zariski closure
        is SL(2), and our orbits lie in the congruence subgroup Γ1 (4), but our obstructions do not; see the
        discussion following Theorem 2.6.
Call an integer admissible if it satisfies the definiteness condition and is not ruled out by any congruence
condition for an orbit. If ν > 1, and there are no further inherited obstructions, then one might expect that
every large enough admissible integer should appear. This is called the local-global principle.
   This has been conjectured in many cases, including by Zaremba for continued fractions built out of
certain finite alphabets [Zar72, p. 76], later refined by Niederreiter in [Nie78], and by Hensley in [Hen96].
The conjecture is most commonly stated as follows.
Zaremba’s Conjecture. There exists n > 0 so that every positive integer is the denominator of a rational
number with continued fraction expansion whose coefficients are at most n.
   Zaremba also conjectured that n = 5 is sufficient, and Hensley gave evidence towards n = 2 being sufficient
for all sufficiently large integers. More generally, one might consider any finite alphabet A for the allowable
coefficients, and ask whether the set of denominators contains all but finitely many positive integers. This
statement can be phrased as a local-global principle for the semigroup ΓA := h( 01 a1 ) : a ∈ Ai+ ∩ SL(2, Z)
corresponding to the alphabet A. Write δA for the Hausdorff dimension of the corresponding limit set.
Bourgain and Kontorovich conjectured the following in various forms1.
Local-Global Conjecture for Continued Fraction Alphabets ([Kon16, Conjecture 6.3.1], [BK18, Con-
jecture 1.11]]). Let A ⊆ N, and consider a linear functional L. Suppose ΓA is Zariski dense in SL(2), has
Hausdorff dimension δA > 1/2, and that L(ΓA v) is infinite. In terms of a growing parameter X, any admis-
sible integer n ≍ X has multiplicity X 2δA −1−o(1) in L(ΓA v).
   For Apollonian circle packings, the local-global conjecture is due to Graham-Lagarias-Mallows-Wilks-Yan
and Fuchs-Sanden in [GLM+ 03], [FS11]. Variants of the conjecture for generalizations of circle packings have
been given by Zhang [Zha18] and jointly by Fuchs, Zhang, and the second author [FSZ19].
   In most cases, the best known result is that a density one of admissible integers appear. For Zaremba’s
conjecture, this is due to Bourgain-Kontorovich [BK14b] and later Frolenkov and Kan [FK14], Huang [Hua15]
and Kan [Kan22]; for Apollonian circle packings this is due to Bourgain-Kontorovich [BK14a] and later
extended by Zhang [Zha18] and jointly by Fuchs, Zhang, and the second author [FSZ19] for certain families
of Kleinian circle packings. The only proof of the full conjecture is by Kontorovich for Soddy sphere packings
[Kon19]. For an introduction, see [Kon13].
   Recently, the local-global conjecture was proven false for many Apollonian circle packings by the authors,
in collaboration with Haag and Kertzer [HKRS23], by identifying reciprocity obstructions. These describe
infinite families of admissible integers that do not appear. The culprit is a reciprocity law, specifically
quadratic and quartic reciprocity.
   We expect these reciprocity obstructions to exist for many other (thin) (semi)groups. In this paper,
we study subsemigroups of SL(2, Z) and exhibit reciprocity obstructions. We consider more specifically
  1Kontorovich assures us the level of generality given here is that which was intended.

                                                             2
semigroups whose matrix entries are non-negative, to which we can associate limit sets consisting of real
numbers with continued fraction expansions satisfying certain restrictions. One might refer to these as
continued fraction semigroups.
   In particular, we disprove the Local-Global Conjecture for Continued Fraction Alphabets. Precisely,
we exhibit reciprocity obstructions for the linear functional L(x, y) = 3x + 5y and the alphabet A =
{4, 8, 12, . . . , 128}. An equivalent way to state this is that rational numbers with continued fractions of
the form [0; a1 , a2 , . . . , an , 1, 1, 2], where the ai ∈ A, cannot have square denominators, despite squares not
being ruled out by congruence, and despite the average multiplicity of denominators tending to infinity. We
do not disprove Zaremba’s conjecture itself.
   In our context, the notion of thin typically means that the semigroup itself or its orbits grow more slowly
than those of the Zariski closure. A precise relationship between orbit growth and Hausdorff dimension is
due to Hensley in the case of a semigroup ΓA ⊆ GL(2, Z) associated to the collection of continued fractions
whose coefficients are chosen from a finite alphabet A. In this case, Hensley [Hen90] shows that

(1.0.1)                              #{w ∈ ΓA v : ||w||∞ < N } ∼ CA N 2δA ,

where δA is the Hausdorff dimension of the associated limit set. The existence of a local-global principle is a
sensible question for such semigroups with Hausdorff dimension exceeding 1/2, since in this case the average
multiplicity of a represented integer tends to ∞ as N → ∞. Although Hensley’s result is not proven for all
continued fraction semigroups, we choose to state our results in terms of Hausdorff dimension.
   A very brief summary of results is contained in the abstract, and the following section contains more
detailed statements.

Software. Computational methods were developed and implemented in C and PARI/GP [PAR23] to inves-
tigate orbits of semigroups. This package [Ric23] is publicly available on GitHub, and also includes methods
to computer-verify many of the claims in this paper (in particular, the function runalltests).

Acknowledgements. The authors would like to thank many people for helpful conversations, among them
Alex Kontorovich, Carlos Matheus, Carlo Pagano, Mark Pollicott, Uri Shapira, Julia Slipantschuk, and
Bianca Viray. They are grateful to the referees for their insightful comments. They are especially indebted
to Mark Pollicott and Julia Slipantschuk for generously providing code for computing Hausdorff dimensions.
The authors are also grateful to the Centre international de rencontres mathématiques (CIRM) and its 2023
Semester II Chaire Jean-Morlet, Jayadev Athreya, for the opportunities for many of these conversations to
take place.


                                            2. Statements of results
  For a rational number q, its continued fraction expansion is

                                                                                       1
                                 q = [a0 ; a1 , a2 , . . . , an ] := a0 +                            ,
                                                                                            1
                                                                              a1 +
                                                                                      ..         1
                                                                                           .+
                                                                                                an
where a0 ∈ Z, ai ∈ Z+ for 1 ≤ i ≤ n. This expression is not unique: instead, there are exactly two ways to
express any rational number as a continued fraction. Indeed, if n = 1 or an > 1, then

                                 [a0 ; a1 , a2 , . . . , an ] = [a0 ; a1 , a2 , . . . , an − 1, 1].

In particular, each rational number has a unique continued fraction with an even length (i.e. with n odd).
Call this the even continued fraction associated
                                                   to q. By convention, we also permit 10 = [0; 0].
   If Γ ⊆ SL(2, Z), define Γ≥0 := { ac db ∈ Γ : a, b, c, d ≥ 0}. If Γ is a group, then Γ≥0 is a semigroup (in
fact, it is a monoid, but the distinction is irrelevant in this paper).
                                                                 3
   Continued fractions of even type can be described2 in terms of the semigroup:
                                                        +
                                      ≥0      1 1       1 0
                              SL(2, Z) =             ,            =: hL, Ri+ .
                                              0 1       1 1
The notation hA1 , A2 , . . .i+ indicates the monoid multiplicatively generated by the Ai , together with the
identity I. If xy is a positive rational number in reduced terms, then
                                                                                    
                     x                                  x     a0 a1 a2 a3 a2n−2 a2n−1 1
(2.0.1)                 = [a0 ; a1 , . . . , a2n−1 ] ⇔     = L R L R ···L      R           .
                     y                                  y                              0
   We will discuss subsemigroups Γ ⊆ SL(2, Z)≥0 and their orbits Γ ( xy ). If ( uv ) ∈ Γ ( xy ), call u the numerator
and v the denominator. The orbit of any such subsemigroup can therefore be interpreted as the collection
of rational numbers whose continued fraction expansions are restricted in some way. Thus all of the results
below have an interpretation in terms of continued fractions; we return to this language towards the end of
the section.
        
   Let xy denote the Kronecker symbol, which is defined for any pair of integers x, y; recall that it is ±1 if
                                            
x and y are coprime, and 0 otherwise. If xy = −1, then neither x nor y is a square. The starting point for
our results is the observation that certain linear fractional transformations preserve Kronecker symbol. For
example, if y is odd, the transformations (x, y) 7→ (x + 4y, y) and (x, y) 7→ (x, 4x + y) satisfy
                                                                   
                                         x        x + 4y           x
                                              =             =
                                         y            y         4x + y
                                                                      
by quadratic reciprocity. As a consequence, the Kronecker symbol xy is constant on orbits of the semigroup
generated by these two transformations. Thus we have semigroup orbits such as
                                                        +  
                                             1 0        1 4        3
                                                    ,                 ,
                                             4 1        0 1        5
which cannot support squares in either entry. That squares are not possible in the first entry is clear a priori,
as it is always 3 (mod 4). But it is possible to show that no congruence obstruction can account for the lack
of squares in the second position.
   Recall that the congruence subgroup Γ1 (4) is defined as
                                    
                      Γ1 (4) = ac db ∈ SL(2, Z) : a ≡ d ≡ 1 (mod 4), c ≡ 0 (mod 4) .
The most important subsemigroup we consider is the maximal semigroup which preserves the Kronecker
symbol on rationals of odd denominator.
Definition 2.1. Let Ψ ⊆ Γ1 (4)≥0 be the set defined by
                                                                              
                        
                   a b ∈ Γ (4)≥0 : ∀ x, y ∈ Z≥0 with y odd, we have  x    ax + by
           Ψ :=     c d     1                                          =             .
                                                                     y    cx + dy
    As the action of Γ1 (4)≥0 preserves the parity of y and nonnegativity of x and y, Ψ is a semigroup.
    It turns out that Ψ has a nice characterization, which demonstrates that not only is it non-trivial, but it
is in some sense half of Γ1 (4)≥0 .
Proposition 2.2 (Proof in Section 3). The semigroup Ψ is characterized as
                                          n                         o
                                     Ψ=      a b ∈ Γ (4)≥0 : a = 1 .
                                             c d    1
                                                                b
   Besides the well-known observation that computation of Kronecker symbols can be accomplished as a
version of the Euclidean algorithm, we are not aware of similar or related statements in the literature. The
only one the authors have been able to locate is [Mil17, Proposition 2], which can be interpreted as giving
a specific element of Ψ. As a statement about continued fraction expansions, we obtain a striking corollary
concerning rationals of “positive Kronecker symbol”: the concatenation of their continued fraction expansions
is again a rational of positive Kronecker symbol. This is detailed in Corollary 3.5.
   2The notational choice of L and R corresponds to these matrices acting as “going left” or “going right” on Conway’s
topograph [Con97, Hat22] or Series’ Farey tesselation [Ser85].
                                                                 4
Definition 2.3. We say that an orbit Γ ( xy ) of a subsemigroup Γ ⊆ SL(2, Z) exhibits a congruence obstruction
modulo n if the set of residues of numerators (or, respectively, denominators) modulo n is not the set of all
residues modulo n. If this happens for at least one orbit, we say Γ exhibits congruence obstructions.
  The semigroup Ψ has congruence obstructions modulo 4: for example, all numerators of Ψ ( 10 ) are 1
(mod 4), and all denominators are 0 (mod 4). On the other hand, numerators in the orbit Ψ ( 23 ) have no
congruence obstructions.
Definition 2.4. We say that an orbit Γ ( xy ) of a subsemigroup Γ ⊆ SL(2, Z) exhibits reciprocity obstructions
if the set X of numerators (or, respectively, denominators) of Γ ( xy ) satisfy
     (1) for all n ≥ 1, the residues modulo n of X include squares; but
     (2) X contains no integer squares.
If this happens for at least one orbit, we say Γ exhibits reciprocity obstructions.
   In other words, a reciprocity obstruction is an obstruction to square values not induced by congruence
obstructions. In this paper we are restricting our attention to the numerator and denominator, but in another
context, one might wish to extend the definitions of congruence and reciprocity obstructions to other linear
functionals. We also restrict our attention to squares for the present, but the future may bestow upon us
other types of obstructions deserving of the name reciprocity (as it did in the Apollonian case, [HKRS23]).
   Our main result about Ψ is that it demonstrates reciprocity obstructions.
Theorem 2.5 (Proof in Section 5). Let x, y be nonnegative coprime integers which satisfy one of the following
conditions:        
                       x
     • y is odd and    y   = −1;
                                      
                                    x
     • (x, y) ≡ (1, 0) (mod 4) and     = −1;
                                   y      
     • (x, y) ≡ (3, 0) (mod 4), and xy = − −1y .

Then the numerators and denominators of the orbit Ψ ( xy ) cannot be squares.
  To conclude that certain orbits have reciprocity obstructions, it is necessary to classify the congruence
obstructions for the orbit and check that they do not themselves already rule out squares; this happens
sometimes, but not always.
Theorem 2.6 (Proof in Section 5.2). Orbits of the semigroup Ψ exhibit the congruence and reciprocity
obstructions listed in Table 1, and furthermore, the table represents a complete list of such. The result is
also effective: let X denote the set of numerators in the orbit Ψ ( xy ) (respectively, denominators), and let r
denote the unique positive real root to the equation
                                                √
                                                  r
                                                          = 7.542795xy.
                                          log r log log r
Let n be any integer that satisfies the corresponding congruence condition from Table 1, and also satisfies
either of the following conditions:
      • n ≥ 2k max(r, 3.41 · 106 ) is not a square, where 2k is the largest power of two at most 8xy;
      • n ≥ 8xy is a square, and there is no corresponding reciprocity obstruction listed in Table 1.
Then n is an element of X.
  We wish to emphasize that these reciprocity obstructions are not present in orbits of the Zariski closure
SL(2), or even in Γ1 (4)≥0 . The following is a statement of strong approximation (for background, see [Rap14]):
                                                                                   b
Proposition 2.7. Let G = Γ1 (4) as a scheme over Spec Z. Then Ψ is dense in Γ1 (4)(Z).
Proof. Note that modulo 2, Ψ and Γ1 (4) coincide. The rest is shown in Theorem 8.1.                           
   Observe that Γ1 (4) has the same congruence obstructions as Ψ but does not have the further reciprocity
obstructions of Theorem 2.6 (this can be verified directly). Thus, the reciprocity obstructions in this paper
are not inherited from any algebraic set.
                                                       5
                           Table 1. Complete characterization of obstructions for Ψ.

                    Orbit type                                 Obstructions
                                    
                                    x            Numerator                 Denominator
             (x, y) (mod 4)         y      congruence reciprocity     congruence reciprocity
                                   −1                        6= n2                     6= n2
                  (1, 0)               ≡ 1 (mod 4)                    ≡ 0 (mod 4)
                                    1                          -                         -
                                    
                                 − −1                          -                       6= n2
                  (3, 0)           y    ≡ 3 (mod 4)                 ≡ 0 (mod 4)
                                    −1
                                    y                          -                         -
                                    −1                       6= n2                     6= n2
                  (∗, 1)                        -                     ≡ 1 (mod 4)
                                    1                          -                         -
                  (∗, 2)                  ≡ 1 (mod 2)          -      ≡ 2 (mod 4)        -
                                    −1                       6= n2                       -
                  (∗, 3)                        -                     ≡ 3 (mod 4)
                                    1                          -                         -


   That the reciprocity obstructions listed in Table 1 do occur for Ψ is a simple application of Theorem 2.5,
but that no other obstructions occur requires more work.
   As Theorem 2.6 is effective, a full local-global result can be proven for specific orbits by combining the
result with a computation. We do so in a simple case (this computation can be recreated with the code
provided at [Ric23]).
Theorem 2.8 (Proof in Section 6). The set of positive integers that are not numerators in the orbit Ψ ( 23 )
is equal to
                 {n2 : n ∈ Z+ } ∪ {3, 6, 7, 10, 12, 15, 18, 19, 27, 31, 34, 55, 63, 99, 115}.
  Although the reciprocity obstructions in Ψ are not a feature of Γ1 (4), it is nevertheless quite a large
semigroup.
Proposition 2.9 (Proof in Section 7.3). The semigroup Ψ is not finitely generated, and has Hausdorff
dimension 1.
   It is interesting to consider subsemigroups which have Hausdorff dimension 1/2 < δ < 1: large enough
that one might ask about the local-global principle, but small enough that such a question is challenging
to answer. It has been shown that congruence obstructions can occur in such continued fraction semigroups
Γ of GL(2, Z) [BK14b, pp. 2-3]. We can generate subsemigroups with reciprocity obstructions by choosing
generators from Ψ.
Theorem 2.10 (Proof in Section 7.3). Given any ǫ > 0, there exists a finitely generated subsemigroup
Γ ⊆ SL(2, Z)≥0 with Hausdorff dimension 1 − ǫ < δ < 1 that exhibits reciprocity obstructions.
  Two such subsemigroups of particular interest are as follows.
Definition 2.11. Define
                                          +                          +
                                   1 1    1 0                       1 4    1 0
                     Ψ1 :=              ,         ,         Ψ2 :=        ,         .
                                   0 1    4 1                       0 1    4 1
  We estimate the respective Hausdorff dimensions of their limit sets as δ1 ≈ 0.719 and δ2 = 0.6045578 ±
10−7 , both of which exceed 1/2. One example of reciprocity obstruction for each of Ψ1 and Ψ2 is as follows.
Proposition 2.12 (Proof in Section 8.2). Numerators in the orbit Ψ1 ( 23 ) have no congruence obstructions,
yet cannot be square. Denominators in the orbit Ψ2 ( 38 ) are only restricted to be 0 (mod 4), yet cannot be
square. In particular, these are both instances of reciprocity obstructions.
  We show that Table 1 is also valid for Ψ1 .
                                                        6
Proposition 2.13 (Proof in Section 8.2). Let x, y be coprime nonnegative integers. Then the congruence
obstructions described in Table 1 still hold for the orbit Ψ1 ( xy ). Furthermore, if a reciprocity obstruction is
listed, then it occurs in the orbit Ψ1 ( xy ) as well.
  While we were able to show that Table 1 completely characterized the orbits of Ψ, we are not able to
do so for Ψ1 . Instead, we collect computational evidence towards this result, and formulate the following
conjecture.
Conjecture 2.14. Table 1 completely characterizes the numbers that can appear as numerators or denom-
inators in orbits of Ψ1 . In other words, every sufficiently large integer that is not ruled out by the given
congruence and reciprocity obstructions will appear in the orbit.
   Based on computational evidence, an example explicit conjecture is the following.
Conjecture 2.15. Every non-square integer n > 10569 appears as a numerator in the orbit Ψ1 ( 23 ).
  Finally, we turn to statements in terms of continued fractions, and compare our results to Zaremba’s
conjecture. The orbits of both Ψ1 and Ψ2 have interesting descriptions in terms of continued fractions.
Proposition 2.16 (Proof in Section 9). Let x, y be coprime nonnegative integers, where the even continued
fraction expansion of xy is [0; a1 , a2 , . . . , a2n−1 ]. For coprime nonnegative integers u, v, we have ( uv ) ∈ Ψ2 ( xy )
if and only if the even continued fraction of uv has the form
                               u
                                 = [4b0 ; 4b1 , 4b2 , . . . , 4b2m , 4b2m+1 + a1 , a2 , . . . , a2n−1 ],
                               v
where the bi are nonnegative integers with bi > 0 if 1 ≤ i ≤ 2m. Similarly, ( uv ) ∈ Ψ1 ( xy ) if and only if the
even continued fraction of uv has the form
                     u
                       = [b0 ; 4b1 , b2 , 4b3 , . . . , b2m−2 , 4b2m−1 , b2m , 4b2m+1 + a1 , a2 , . . . , a2n−1 ],
                     v
where the bi are nonnegative integers with bi > 0 if 1 ≤ i ≤ 2m.
   Stated more informally, for Ψ2 , the continued fraction is built from the alphabet {4, 8, 12, 16, . . .}, with
the tail being the continued fraction of uv . For Ψ1 , we have a similar description, except only every other
term must be a multiple of 4. This allows us to describe denominators of rationals built from the alphabet
4Z+ in terms of an orbit of Ψ2 .
Corollary 2.17 (Proof in Section 9). Let S be the set of denominators of rational numbers in (0, 1) which
have continued fractions that can be built from the alphabet 4Z+ . Then S is the union of the numerators and
denominators of the orbit Ψ2 ( 01 ).
     Since orbits of Ψ2 exhibit reciprocity obstructions, this shows that such obstructions exist in a context
with the flavour of Zaremba’s conjecture. However, Zaremba’s conjecture as stated remains untouched: it
deals with continued fractions built from a finite alphabet A = {1, 2, . . . , A} 6⊆ 4Z+ , as well as the orbit of
( 01 ). These do not exhibit reciprocity obstructions of the type we study.
     We give a more explicit example class of orbits with reciprocity obstructions.
Theorem 2.18 (Proof in Section 9). Let A be a subset of 4Z+ containing 4 and 8, and let ΨA ⊆ GL(2, Z)
be the semigroup corresponding to continued fractions built from this alphabet, i.e.
                                                    ΨA = h( 01 a1 ) : a ∈ Ai+ .
                                                                                                                      
Then ΨA ( xy ) exhibits reciprocity obstructions in the denominator if y ≡ 1 (mod 4), x is odd, and                   x
                                                                                                                      y    = −1.

   Requiring the alphabet to contain 4, 8 ensures the congruence obstructions admit squares, giving rise
to a reciprocity obstruction. One example of such an orbit is ΨA ( 35 ). The congruence condition on the
denominator is 1 (mod 2), which admits squares, but no square denominators occur. Since 3/5 = [0; 1, 1, 2],
when stated in terms of continued fractions, we obtain the following result.
                                                                  7
Corollary 2.19 (Proof in Section 9). Let A be a subset of 4Z+ containing 4 and 8.
  Consider the set S of rational numbers which have a continued fraction expansion of the form
                                           [0; a1 , a2 , . . . , an , 1, 1, 2],
where ai ∈ A. Then all positive odd numbers are admissible as denominators for elements of S, yet no
denominator is a square.
   Equivalently, consider the set S ′ of rational numbers which have a continued fraction expansion of the
form
                                               [0; a1 , a2 , . . . , an ],
where ai ∈ A. Let L(x/y) = 3x + 5y. Then all positive odd numbers are admissible for L(S ′ ), yet L(S ′ )
contains no squares.
   Which of the two phrasings one prefers is a matter of taste, but the second phrasing is an example subject
to the Local-Global Conjecture for Continued Fraction Alphabets, so we immediately obtain the following
result.
Theorem 2.20. The Local-Global Conjecture for Continued Fraction Alphabets is false.
   The smallest subalphabet of 4Z+ for which the Hausdorff dimension exceeds 1/2 is A = {4, 8, 12, . . . , 128},
where ΨA has Hausdorff dimension δA = 0.500890640842 ± 10−12 > 0.5 (many thanks go to Julia Sli-
pantschuk, who shared with us her code to rigorously compute Hausdorff dimensions for finite alphabets;
see [PS23, BS20]).
   Finally, we can combine orbits to find a larger family of continued fractions which miss squares.
Corollary 2.21 (Proof in Section 9). Let S be the set of rational numbers which have a continued fraction
expansion of the form
                                    [0; 4a1 , 4a2 , . . . , 4an , an+1 , 1, 2],
where the ai are positive integers. Then all positive integers are admissible as denominators for elements of
S, yet no denominator is a square.
  A computation suggests the following conjecture.
Conjecture 2.22. For all non-square integers v > 7968219670470, there exists a coprime positive integer
u < v for which
                                    u
                                      = [0; 4a1 , 4a2 , . . . , 4an , an+1 , 1, 2],
                                    v
where the ai are positive integers.
   In Section 3, we cover some technical results concerning Kronecker symbols and their behaviour under
Möbius transformation, which proves Proposition 2.2. These results rule out squares in certain orbits of Ψ
without too much work, but to claim an interesting obstruction, we intend to show everything else sufficiently
large will appear. To this end, the very technical Section 4 applies the results of Section 3 to give sufficient
conditions for integers to appear in orbits of Ψ; and in turn, we can then use these to give complete orbits in
the following Section 5, where the main results for Ψ (namely, Theorems 2.5 and 2.6) are proven. The explicit
example of Theorem 2.8 is covered in Section 6. Subsemigroups of smaller Hausdorff dimension are covered in
Sections 7 and 8, and consequences for continued fractions are addressed in Section 9. Some remarks related
to finding subgroups of SL(2, Z) exhibiting reciprocity obstructions are considered in Section 10.

             3. Behaviour of the Kronecker symbol under Möbius transformation
  In this section, we proveProposition
                                                the way, we develop the main machine (Proposition 3.2),
                                        2.2. Along
                           ax+by
which is an expression for cx+dy  in terms of xy , and is used extensively throughout the paper.
  Recall from the introduction that
                                                                                    
                         
                     a b ∈ Γ (4)≥0 : ∀x, y ∈ Z≥0 with y odd, we have    x       ax + by
             Ψ :=    c d     1                                              =              .
                                                                        y       cx + dy
                                                            8
As observed there, this is a sub-semigroup of Γ1 (4)≥0 . In order to make it explicit, however, we wish to show
that, equivalently,
                                         n                           o
                                     Ψ=     a b ∈ Γ (4)≥0 : a = 1 .
                                            c d      1
                                                                 b
This is the statement of Proposition 2.2. We begin by showing that, in Γ1 (4)≥0 , the Kronecker symbols of
rows and columns all agree.
                       
Lemma 3.1. Let ac db ∈ Γ1 (4)≥0 . Then
                                        a  c  a  b 
                                             =       =        =       .
                                         b        d        c       d

                entries are nonnegative, the Kroneckern+m
Proof. Since all                                                symbol
                                                                         is multiplicative in the numerator, and
 4n+m        m                                                            m
   n     =   n  . Furthermore,   if n 6
                                      ≡   2  (mod
                                                  4),  then
                                                               n     =   n . If at least one of m, n is 1 (mod 4),
then quadratic reciprocity implies that m     n   =  m
                                                      n
                                                         . We  compute:
                             a   d   ad   d   bc + 1   d   b 
                                  =                =                    =         =       ,
                              b         b      b         b       b            b       d
                                                                 
noting that 4b | bc, and d ≡ 1 (mod 4). Similarly, ac = dc . Finally,
                                                                        
                           b        c     bc        c      ad − 1       c       −1       c
                                =                =                  =               =       ,
                           d        d      d        d        d          d       d        d
since d ≡ 1 (mod 4).                                                                                             
                                                                
  To prove Proposition 2.2, it suffices to show that if c d ∈ Γ1 (4)≥0 , then
                                                            a b

                                                      
                                            ax + by      a   x
                                                      =           ,
                                            cx + dy      b   y
when x, y are coprime nonnegative integers with y odd.
   We will give a brief demonstration of this property in one case, before giving the full technical details. To
this end, suppose for simplicity that (x, y) ≡ (0, 1) (mod 4) and gcd(x, d) = 1. In particular, we have
                              c, x ≡ 0 (mod 4),      a, d, y, cx + dy ≡ 1 (mod 4),
so that a Kronecker symbol involving an entry from the second list a, d, y, cx + dy will take the same value
when its entries are swapped, by quadratic reciprocity. In addition,    a Kronecker symbol with any of these
                                                              m 
entries is “modular” in the other entry, i.e., m+n
                                                 n     =   m
                                                           n   =   m+n , and they are multiplicative in either
entry. Finally, note that d(ax + by) − b(cx + dy) = x. Then,
                                                                
                              ax + by           d         d(ax + by)
                                        =
                              cx + dy        cx + dy       cx + dy
                                                                               
                                                d         d(ax + by) − b(cx + dy)
                                        =
                                             cx + dy              cx + dy
                                                                  
                                                d            x           d      x
                                        =                           =
                                             cx + dy      cx + dy       cx     dy
                                                  
                                             d     d     x    x       a    x
                                        =                         =            .
                                             c     x     d    y       b    y
   The next proposition gives the action of SL(2, Z)≥0 on the Kronecker symbol in greatest generality. It
follows the same outline as the above computation.
                                                             
Proposition 3.2. Define no to be the odd part of n. Let ac db ∈ SL(2, Z)≥0 , let x, y be nonnegative integers,
and assume that gcd(x, d) = 1. Let
           xo − 1          do − 1          (cx + dy)o − 1           yo − 1
      A=          ,   B=          ,   C=                  ,    D=          ,   α = AB + AC + BC + AD,
              2               2                  2                     2
                                                        9
and let                 (                                                                (                          
                              cdxy+1                                                               bx(cx+dy)+1
                                 2               if 2 || d or 2 || x;                                   2                      if 2 || cx + dy;
                 µ1 =                                                               µ2 =
                          1                      else;                                         1                               else.
Then                                                              
                                                         ax + by                                c  x
                                                                                    α
                                                                       = (−1) µ1 µ2                                .
                                                         cx + dy                                   d           y
Proof. If x, y are not coprime, the result is immediate. Otherwise, as gcd(x, d) = 1, gcd(d, cx + dy) = 1. Then
                                                                                   
    ax + by             d        adx + bdy            cx + dy     adx + bdy − b(cx + dy)
                =                              = ǫ1            ǫ2
    cx + dy          cx + dy      cx + dy                d                cx + dy
                                                                                             cx   x 
                                                                                 = ǫ1 ǫ2 ǫ3                  ,
                                                                                               d    cx + dy
where, by quadratic reciprocity, ǫ1 = (−1)BC , and ǫ2 and ǫ3 are as follows. If cx + dy 6≡ 2 (mod 4), then
ǫ2 = 1. Otherwise, x is necessarily odd, and we have3
                                                                                         
                      adx + bdy  x          (bc + 1)x + bdy  x         bx(cx + dy) + x2
              ǫ2 =                        =                           =                          = µ2 ,
                          2          2               2             2               2
                                 
since x2 ≡ 1 (mod 8) and 2· is well defined modulo 8. Similarly, the term ǫ3 is 1 if d 6≡ 2 (mod 4).
Otherwise,                                                                     
                               cx + dy  cx         cdxy + (cx)2         cxdy + 1
                       ǫ3 =                      =                    =                = µ1 ,
                                  2         2              2                  2
as cx is necessarily odd (it is coprime to d). Moving forward,
       cx   x   c   x   cx + dy                   c   x   dy             c  x d  y 
                         =             ǫ4             = ǫ4            ǫ5        = ǫ4 ǫ5                     .
         d    cx + dy         d    d           x             d     d       x              d    d    x   x
It is immediate that ǫ4 = (−1)AC , and ǫ5 = 1 if x 6≡ 2 (mod 4). Otherwise,
                                                                       
                             cx + dy    dy        cdxy + (dy)2       cxdy + 1
                      ǫ5 =                   =                   =              = µ1 ,
                                2        2               2               2
since dy is necessarily odd (using gcd(x, y) = 1). Note that we can combine 2 || x with 2 || d in the statement
since both conditions cannot occur simultaneously.
   Finally,
                                     c  x d y   c            
                                                                       x
                                                         =      ǫ6 ǫ7     ,
                                      d    d    x    x       d         y
where ǫ6 = (−1)AB and ǫ7 = (−1)AD . Combining this all together gives the proposition.                                                            
   While Proposition 3.2 has complicated conditions, they often collapse when certain modulo 4 conditions
are added to some of a, b, c, d. Code to computationally check this formula is found in [Ric23].
   To prove Proposition 2.2, we would like an analogous theorem where we do not have to assume that
gcd(x, d) = 1; the rest of the section is devoted to this.
Lemma 3.3. Let x, y be positive coprime integers and let k be a nonnegative integer. Suppose either x 6≡ 3
(mod 4) or v2 (k) ≥ v2 (y), where v2 (n) denotes the largest power of 2 dividing n. Then
                                                             
                                               x           x
                                                   =              .
                                               y        y + 4kx
Proof. From quadratic reciprocity, we have
                                                                         
                       x              α1   y + 4kx         α1 y        α1 +α2  x
                              = (−1)                 = (−1)      = (−1)           ,
                    y + 4kx                   x               x                y
                                                                                                              
  3Recall that if n is odd,       kn+m
                                             =       kn+m        kn+m
                                                                            =       kn+m       m
                                                                                                   
                                                                                                       =       kn+m        m
                                                                                                                                  m
                                                                                                                                        
                                                                                                                                         .
                                   2n                  2           n                  2        n                 2         2       2n
                                                                                10
where
                                         xo − 1 (y + 4kx)o − 1                     xo − 1 y o − 1
                                  α1 =         ·               ,           α2 =          ·        .
                                            2         2                               2       2
If x ≡ 1 (mod 4) then we are done. Since y + 4kx ≡ y (mod 4), if y is odd, then α1 = α2 , and we are
again done. This leaves the case of x ≡ 3 (mod 4). Since v2 (k) ≥ v2 (y), the odd parts of y and y + 4kx are
equivalent modulo 4, which completes the proof.                                                           

   We can now show that the action of Γ1 (4)≥0 on Kronecker symbols is relatively well-behaved. This will
be used to prove Proposition 2.2 and Theorem 2.5.
                         
Lemma 3.4. Let ac db ∈ Γ1 (4)≥0 and let x, y ∈ Z≥0 be coprime integers, where y 6≡ 2 (mod 4) or b ≡ 0
(mod 4). Then
                                    c  x                                            
                 ax + by                                     xo − 1 y o − 1 (cx + dy)o − 1
                            = (−1)α             , where α =                   +              .
                 cx + dy               d     y                  2       2         2
                                                                          x
                                                              ax+by
In particular, if y is odd or (x, y) ≡ (1, 0) (mod 4), then cx+dy     = ab    y .

Proof. If gcd(x, d) = 1, then the first statement follows immediately from Proposition 3.2.                     
   In general, we will show that we can always reduce to this case. Consider replacing ac db by c+2ar ka d+2br kb ∈
Γ1 (4)≥0 for some non-negative integer k and a fixed integer r ≥ 2. Choose r large enough so that (cx+dy)o ≡
((c + 2r ka)x + (d + 2r kb)y)o (mod 4), and r ≥ v2 (cx + dy) + 2 if ax + by ≡ 3 (mod 4). By Lemma 3.3, we
have
                                                                            
                                    ax + by                  ax + by
                                              =                                  .
                                    cx + dy        (c + 2r ka)x + (d + 2r kb)y
                       
Since c+2ar ka d+2br kb ∈ Γ1 (4)≥0 , Lemma 3.1 gives
                                                         
                                            c + 2r ka        a       c
                                                 r
                                                        =       =      ,
                                            d + 2 kb         b      d
so it suffices to prove the proposition for this new matrix. As d is odd, gcd(d, 2r b) = 1, so there exists a
non-negative integer k such that d + k(2r b) is coprime to x. By using this value of k, we have reduced to the
case of gcd(x, d) = 1, completing the proof.
   The final sentence follows from Lemma 3.1 and noting that α is even in the listed cases.                 

   Proposition 2.2 follows as a corollary, since if y is odd, we have
                                                              
                                                   ax + by         a       x
(3.0.1)                                                        =                 ,
                                                   cx + dy         b       y
                                                      
which is always equal to xy if and only if ab = 1.
   There are some interesting consequences of Proposition 2.2 in the language of continued fractions.
                                                                                                                     
Corollary 3.5. Let S ⊆ (0, 1) be the subset of rational numbers s/t in lowest form such that st = 1, and
(s, t) ≡ (1, 0) (mod 4). Then if [0; a1 , a2 , . . . , a2m−1 ] and [0; b1 , b2 , . . . , b2n−1 ] are the even continued fraction
expansions for two elements of S, then the concatenation [0; a1 , a2 , . . . , a2m−2 , a2m−1 + b1 , b2 , . . . , b2n−1 ] is
the even continued fraction expansion for some element of S.

Proof. Let st11 = [0; a1 , a2 , . . . , a2m−1 ], st22 = [0; b1 , b2 , . . . , b2m−1 ] ∈ S, and define

                              M1 = L0 Ra1 La2 · · · Ra2m−1 , M2 = L0 Rb1 Lb2 · · · Rb2n−1 .
                                                  
Since ( stii ) = Mi ( 10 ), we have Mi = stii dbii ∈ Ψ by the definition of S. Thus M1 M2 ∈ Ψ. The rational
number formed by the first column is thus an element of S.                                               
                                                                   11
                              v

                     n = 49   bc   bc       bc   bc       bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc


                              bc   bc       bc   bc
                                                      3
                                                         bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc


                              bc   bc       bc   bc   8 bc     bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc


                              bc   bc       bc   bc       bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc



                     n = 28   bc   bc
                                        1
                                           bc   bc       bc   bc   bc       bc      bc
                                                                                          8
                                                                                             bc   bc   bc   bc   bc      bc       bc   bc


                              bc   bc   5 bc     bc       bc   bc   bc       bc    bc     5 bc     bc   bc   bc   bc      bc       bc   bc


                              bc   bc       bc   bc       bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc


                              bc   bc       bc   bc       bc   bc   bc
                                                                         6
                                                                            bc      bc       bc   bc   bc   bc   bc
                                                                                                                       13
                                                                                                                          bc
                                                                                                                                  bc   bc


                              bc   bc       bc   bc       bc   bc   bc   2 bc        bc       bc   bc   bc   bc   bc   2 bc        bc   bc


                              bc   bc       bc   bc       bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc



                          0   bc   bc       bc   bc       bc   bc   bc       bc      bc       bc   bc   bc   bc   bc      bc       bc   bc
                                                                                                                                             u
                              0
        Figure 1. The upper diagonal line is n = 3u + 5v for n = 49; the lower line is n = 3u + 5v
        for n = 28. Integer points are marked. A white-filled dot indicates that the point gives rise
        to a numerator n in the orbit Ψ ( 35 ). Since this orbit avoids squares, there are no white dots
        on the line for n = 49.

            4. Sufficient conditions for integers to be represented by orbits of Ψ
   In this section, we give a series of lemmas providing sufficient conditions for integers to appear in orbits of
Ψ. The results depend on the Kronecker symbol properties of Ψ from the previous section. The general form of
the conditions is as follows. Consider a non-negative integer n ≡ y (mod 4) (respectively x (mod gcd(y, 4))).
Then n will appear as a denominator (respectively, numerator) in Ψ ( xy ) if the following holds: any sequence
      n
of ⌊ 8xy ⌋ consecutive integers contains terms which have Kronecker symbols of both values 1 and −1 modulo
the odd part no of n. This type of sufficient condition will typically be satisfied for large enough n, which
we will exploit in the next section.
   We begin by stating an explicit equivalent condition for an integer to appear.
Lemma 4.1. Let x, y be nonnegative coprime integers. A positive integer n appears as a numerator in the
orbit Ψ ( xy ) if and only if there exist nonnegative integers u, v such that
                                                                        u
                                    u ≡ 1 (mod 4), ux + vy = n,               = 1.
                                                                          v
Similarly, n appears as a denominator if and only if there exist nonnegative integers u, v such that
                                                                                   u
                         u ≡ 0 (mod 4), v ≡ 1 (mod 4), ux + vy = n,                     = 1.
                                                                                    v
                                                                           
Proof. If n is a numerator, there is a matrix ac db ∈ Ψ for which ac db ( xy ) = ( m  n
                                                                                        ) for some integer m. Then
(u, v) = (a, b) gives the claimed pair.                                                                      
   For the other direction of the first (numerator) statement, assume such a pair (u, v) exists. As uv = 1,
they are coprime, so there exists integers c, d for which du − cv = 1. By replacing c by c + uk and d by d + vk
for a large positive integer k ≡ −c (mod 4), we can assume that c, d are non-negative and c ≡ 0 (mod 4).
Since u ≡ 1 (mod 4), it follows that d ≡ 1 (mod 4), hence ( uc dv ) ∈ Ψ, showing that n is a numerator of the
orbit.
   The denominator case follows analogously, noting that there is now a residue condition on v as well. 
   Lemma 4.1 is illustrated in Figure 1. As n grows, the number of integer points in the first quadrant on
the line n = ux + vy increases: for n to appear as a numerator or denominator, at least one point must
satisfy certain congruence and Kronecker conditions. As n grows, we expect this to become more common.
The easiest case of Lemma 4.1 to analyze is if either x = 0 or y = 0, which follows immediately.
Corollary 4.2. The following are true:
    • The set of numerators of Ψ ( 01 ) is the set of all positive integers;
                                                                                  12
      • The set of denominators of Ψ ( 01 ) is the set of all positive integers equivalent to 1 (mod 4);
      • The set of numerators of Ψ ( 10 ) is the set of all positive integers equivalent to 1 (mod 4);
      • The set of denominators of Ψ ( 10 ) is the set of all positive integers equivalent to 0 (mod 4).
   Assuming x, y > 0, we want to use Lemma 4.1 to produce sufficient conditions. We start with the easier
case of the denominator.
Lemma 4.3. Let x and y be coprime positive integers, and let n be a positive integer satisfying n ≡ y
(mod 4). Furthermore, assume that at least one of the following conditions holds:
      • n ≥ 8xy and n = 2m2 for some integer m;
                                          n                                             r− 
      • in any consecutive sequence of ⌊ 8xy ⌋ integers, there is an integer r− with    no = −1 and an integer
                 r+ 
        r+ with no = 1.
Then n is a denominator in the orbit Ψ ( xy ).
Proof. The overall plan of the proof is to range through the solutions (u(k), v(k)) to the linear equation of
Lemma 4.1 by parametrizing in terms of a variable k, and then use Proposition   3.2 to evaluate whether the
                                                               xy               u(k)
Kronecker symbol is 1. For this purpose, we define a matrix ( c d ) to apply to v(k) , so that the Proposition
                                        
describes the Kronecker symbol u(k)  v(k) in terms of a symbol with fixed denominator, and numerator ranging
through an arithmetic progression controlled by k. The trick is that u(k)x + v(k)y = n, a constant in terms
of k.
   Setting up the list of solutions to n = ux + vy with (u, v) ≡ (0, 1) (mod 4). As n ≡ y (mod 4),
there exists integers (u, v) satisfying ux + vy = n with u ≡ 0 (mod 4) and v ≡ 1 (mod 4). Pick the solution
with smallest nonnegative value of u, say (u0 , v0 ). Then (u, v) = (u0 + 4yk, v0 − 4xk) for k ∈ Z gives the
general solution to the system of equations ux + vy = n, u ≡ 0 (mod 4), v ≡ 1 (mod 4).
   In particular,
      • 0 ≤ u0 < 4y;
                                                                 n
      • (u0 , v0 ) is a nonnegative pair if and only if 0 ≤ k ≤ 4xy − u4y0 .
Lemma 4.1 implies that n is a denominator of the orbit Ψ ( xy ) if and only if there exists an integer k with
                                   n     u0           u   u + 4yk 
                                                                    0
(4.0.1)                   0≤k≤        −       and           =                 = 1.
                                  4xy 4y               v          v0 − 4xk
  Finding a suitable matrix for Proposition 3.2. Next, fix a pair of integers (c0 , d0 ) such that
(4.0.2)                                            xd0 − yc0 = 1.
                                        x      y  
For any integer s, we have M =       c0 +sx d0 +sy ∈ SL(2, Z). We wish to choose s such that:
      • c = c0 + sx and d = d0 + sy are nonnegative;
                                                                        n
      • d is coprime to all numbers of the form u0 + 4yk where 0 ≤ k ≤ 4xy − u4y0 ;
      • if 4 ∤ y, then d ≡ no (mod 4)
   We justify why this is possible. As x, y > 0, the first condition is satisfied for any sufficiently large s. The
second can be satisfied since gcd(d0 , y) = 1, making d0 + sy an arithmetic progression with coprime residue
and modulus. If y is odd, then the third point can be satisfied simultaneously. If 2 || y, then d0 is necessarily
odd from (4.0.2), and the third condition holds for either all s odd or all s even.
   Applying Proposition 3.2. Thus suppose we have chosen s, and hence c and d, as desired. Apply
Proposition 3.2 to the matrix ( xc dy ) and pair (u, v) = (u0 + 4yk, v0 − 4xk) (note that the second chosen
condition guarantees the hypotheses of Proposition 3.2 are satisfied), to obtain
                                                                   c  u
                                           n
                                                      = (−1)α µ1 µ2             .
                                    cu0 + dv0 − 4k                     d    v
Applying quadratic reciprocity and rearranging yields
                      u                              c   cu + dv − 4k 
                                                                0    0
(4.0.3)                    = (−1)AB+AC+BC+AD+CE µ1 µ2                        ,
                        v                               d          n
                                                         13
where
               uo − 1              do − 1                (cu0 + dv0 − 4k)o − 1                 vo − 1            no − 1
          A=          ,       B=          ,       C=                           ,        D=            ,    E=           ,
                  2                   2                            2                              2                 2
and                   (                                                     (                 
                              cduv+1
                                                                                yu(cu+dv)+1
                                 2         if 2 || d or 2 || u;                       2            if 2 || cu + dv;
               µ1 =                                             ,    µ2 =
                          1                else;                             1                     else.
  Analyzing the various imposed conditions allows us to greatly simplify (4.0.3). First, cu0 + dv0 − 4k ≡ d
(mod 4), which is necessarily odd. Thus B = C. Since D ≡ 0 (mod 2), we obtain
                                AB + AC + BC + AD + CE ≡ B(B + E) (mod 2).
This is 0 if and only if either do ≡ 1 (mod 4) or do ≡ no (mod 4). Also, B = E if in addition 4 ∤ y (using
the choice of c, d). Therefore the power of −1 in (4.0.3) is −1 if and only if 4 | y, x ≡ 3 (mod 4), and no ≡ 1
(mod 4) (using xd ≡ 1 (mod 4) since 4 | y).
   As cu + dv ≡ d ≡ 1 (mod 2) (d was chosen to be odd) and 4 | u, µ1 = µ2 = 1. Putting this all together
gives
                                      u        c   cu + dv − 4k 
                                                          0     0
(4.0.4)                                     =±                           ,
                                       v          d           n
where the ± is − if and only if 4 | y, x ≡ 3 (mod 4), and no ≡ 1 (mod 4).             
   Finding the needed Kronecker symbol. The equation (4.0.4) is a formula for uv in terms of k. We
now proceed to demonstrate that it takes a value +1 for some k in the range (4.0.1).
   Case A: Assume the first condition of the lemma holds. Then n = 2m2 = xu + yv. Thus
                      u        c   cu + dv − 4k         c   cu + dv − 4k 
                                          0     0                      0     0
(4.0.5)                    =±                           =±                          .
                       v           d          n                d           2
The values of k = 0 and k = 1 give opposite values for this expression, so we are done as long as both are
                        n
in our range, i.e. 1 ≤ 4xy − u4y0 . This is implied by the condition of n ≥ 8xy.
   Case B: Assume the second condition of the lemma holds. Let k = 2k ′ be even, and consider
                u                                                                         
                             cu0 + dv0 − 8k ′      cu0 + dv0 − 8k ′         (cu0 + dv0 )/8 − k ′
                      =±                                              =±                           ,
                   v                2v2 (n)              no                         no
                                               
where values independent of k ′ (such as dc ) get absorbed into the ±, and (cu0 + dv0 )/8 is regarded as any
integer equivalent to this modulo no . The possible values of k ′ are
                                                           n     u0
                                                0 ≤ k′ ≤      − ,
                                                          8xy 8y
                                 n
giving a sequence of at least ⌊ 8xy ⌋ consecutive integers. By the assumption, the resulting Kronecker symbol
                                                          
can be both +1 and −1 in this range, proving that uv = 1 has a solution.                                   
  The above lemma does not apply when n is a square. For this, we follow a similar proof, but the final
analysis is slightly different.
Lemma 4.4. Let x and y be coprime positive integers, and let n ≥ 4xy be an integral square satisfying n ≡ y
(mod 4). Furthermore, assume that one of the following is true:
                           
    • y ≡ 1 (mod 4) and xy = 1;
                                  
    • (x, y) ≡ (1, 0) (mod 4) and xy = 1;
                                    
    • (x, y) ≡ (3, 0) (mod 4) and xy = −1  y ;

Then n is a denominator in the orbit Ψ ( xy ).
Proof. The proof of Lemma 4.3 up to equation (4.0.4) is still valid. To summarize, we have a solution
u0 x + v0 y = n with u0 ≡ 0 (mod 4) and v0 ≡ 1 (mod 4), where u0 ≥ 0 is minimized. We are looking for
                                                  n
pairs (u, v) = (u0 + 4yk, v0 − 4xk) with 0 ≤ k ≤ 4xy − u4y0 and uv = 1.
                                                                    14
   Nonnegative integers c, d were chosen such that xd − yc = 1, d is coprime to all possible u values, and if
y is odd, then d ≡ no ≡ 1 (mod 4) (since no is still a square). As n is a square, (4.0.4) implies that
                                              u        c
                                                    =±        ,
                                                v         d
where the ± is + except for (x, y) ≡ (3, 0) (mod 4).                      
   Case 1: Suppose y is odd or (x, y) ≡ (1, 0) (mod 4), and suppose xy = 1. Then d ≡ 1 (mod 4), and
                                                                 
Lemma 3.1 applies to ( xy dc ), showing that dc = xy . Therefore uv = 1, so there is a solution as long as
 n    u0
4xy − 4y ≥ 0, which follows from n ≥ 4xy.                                         
   Case 2: Suppose that (x, y) ≡ (3, 0) (mod 4) and xy = −1       y . Then v
                                                                            u
                                                                                = − dc . We have d ≡ 3
(mod 4), and as in the proof of Lemma 3.1,
      c   y   cy                                                           
                                   o       d    dx − 1         −1    x   xd          cy + 1
           =             = (−1)(y −1)/2                  =−                    =−             = −1.
       d      d     d                      y      d            y     y    y             y
         
Thus uv = 1, and we finish as in the first case.                                                        
   The extra difficulty for the numerator case is that v (mod 4) is not necessarily fixed; otherwise the proof
follows a similar path.
Lemma 4.5. Let x and y be coprime positive integers, and let n be a positive integer satisfying n ≡ x
(mod gcd(y, 4)). Furthermore, assume that at least one of the following conditions holds:
     • n ≥ 8xy and n = 2m2 for some integer m;                                           
                                          n
     • in any consecutive sequence of ⌊ 8xy  ⌋ integers, there is an integer r− with rn−o = −1 and an integer
                   
       r+ with rn+o = 1.
Then n is a numerator in the orbit Ψ ( xy ).
Proof. The proof follows the same plan as for Lemma 4.3, so we will highlight the differences.
   Setting up the list of solutions to n = ux + vy with u ≡ 1 (mod 4). As n ≡ x (mod gcd(y, 4)),
there exists integers (u, v) satisfying ux + vy = n with u ≡ 1 (mod 4). Pick the solution with smallest
nonnegative value of u, say (u0 , v0 ), and let h ∈ {1, 2, 4} be the smallest positive integer such that 4 | hy.
Then (u, v) = (u0 + hyk, v0 − hxk) for k ∈ Z gives the general solution to the system of equations ux+ vy = n
and u ≡ 1 (mod 4).
   In particular,
      • 0 ≤ u0 < hy;
                                                                      n    u0
      • this solution is a nonnegative pair if and only if 0 ≤ k ≤ hxy  − hy  .
Lemma 4.1 implies that n is a numerator of the orbit Ψ ( xy ) if and only if there exists an integer k with
                                   n     u0           u   u + hyk 
                                                                   0
                          0≤k≤        −        and           =                 = 1.
                                  hxy    hy            v          v0 − hxk
  Finding a suitable matrix for Proposition 3.2. As before, fix a pair of integers (c0 , d0 ) such that
                                                  xd0 − yc0 = 1.
                                      x      y  
For any integer s, we have M =     c0 +sx d0 +sy ∈ SL(2, Z). We wish to choose s such that:
      • c = c0 + sx and d = d0 + sy are nonnegative;
                                                                              n     u0
      • d is coprime to all numbers of the form u0 + hyk where 0 ≤ k ≤ hxy        − hy ;
              o
      • d ≡ n (mod 4) (in particular, d is odd).
The justification for the existence of s is exactly as in Lemma 4.3, except that we must also demonstrate
the last bullet when 4 | y. In this case, the assumptions on x imply that x is odd and x ≡ n (mod 4).
Furthermore, xd0 ≡ xd0 − yc0 ≡ 1 (mod 4), whence no ≡ n ≡ x ≡ d0 ≡ d (mod 4).
   Applying Proposition 3.2. As in Lemma 4.3, suppose we have chosen s, and hence c and d, as desired,
and apply Proposition 3.2 to the matrix ( xc dy ) and pair (u, v) = (u0 + hyk, v0 − hxk), to obtain
                        u                                      c   cu + dv − hk 
                                                                          0     0
(4.0.6)                      = (−1)AB+AC+BC+AD+CE µ1 µ2                                  ,
                         v                                        d           n
                                                       15
where
                uo − 1              do − 1               (cu0 + dv0 − hk)o − 1                  vo − 1            no − 1
          A=           ,       B=          ,       C=                          ,         D=            ,    E=           ,
                   2                   2                           2                               2                 2
and                    (                                                     (                 
                               cduv+1
                                                                                 yu(cu+dv)+1
                                  2         if 2 || d or 2 || u;                       2            if 2 || cu + dv;
                µ1 =                                             ,    µ2 =
                           1                else;                             1                     else.
As u = u0 + hyk ≡ 1 (mod 4), we have that A is even, so AB + AC + BC + AD + CE ≡ C(B + E)
(mod 2). Since do ≡ d ≡ no (mod 4) by assumption, we have B ≡ E (mod 2), so C(B + E) ≡ 0 (mod 2).
In particular, the power of −1 in (4.0.6) is always 1.
   Next, d is odd and u ≡ 1 (mod 4), hence µ1 = 1. This gives the much more palatable
                                     u         c   cu + dv − hk 
                                                          0     0
(4.0.7)                                    = µ2                        .
                                       v          d           n
    Finding the needed Kronecker symbol. We break into cases.
    Case A: Assume the first condition of the lemma holds. Then 2m2 = n = xu + yv. Since gcd(cu +
dv, 2m2 ) = gcd(cu + dv, xu + yv) = gcd(u, v) is odd (since u is odd), we conclude cu + dv is odd, and
therefore µ2 = 1. Furthermore, y is necessarily odd, so h = 4, and (4.0.5) from Lemma 4.3 holds, where the
sign is positive. As in Lemma 4.3, we are done if n ≥ 8xy.
    Case B: We will assume instead that the second condition of the lemma holds. We will divide into cases
based on v2 (y).
    Case B1: 4 | y. Hence h = 1 and n is odd (from n ≡ x (mod 4) and x being odd). If 2 || cu + dv, then
8 | yu(cu + dv), hence µ2 = 1 always. Thus
                                         u   c   cu + dv − k 
                                                         0      0
                                               =                       .
                                          v       d           n
                                           n
                                                                                                
As u0 < y, we have a block of at least ⌊ xy  ⌋ consecutive integers that we are evaluating in n· , and we will
                                                                                                    
be done if they take the values of −1 and 1 (since one of those will equal the fixed quantity dc ). This is
implied by our assumption.
    Case B2: 2 || y. Hence h = 2 and n is odd. Then cu + dv = cu0 + dv0 − 2k is always even or always odd.
If it is always odd, then µ2 = 1, and we obtain
                       u   c   cu + dv − 2k   c   2   (cu + dv )/2 − k 
                                      0       0                          0     0
                           =                          =                                  ,
                        v     d             n             d     n            n
where division is taken modulo the denominator of the Kronecker symbol, i.e. modulo n. Similarly to Case
                                        n
B1, we have a sequence of at least ⌊ 2xy    ⌋ consecutive Kronecker symbols, so we can pick a value of k giving
 u
               c
                   2
 v   =  1 (as   d   n   is independent of  k).
   If cu+dv is always even, then by considering only even k or only odd k, we can ensure that 4 | cu+dv, once
                                                                                     n
again making µ2 = 1. Analogous equations hold, yielding a sequence of at least ⌊ 4xy   ⌋ consecutive Kronecker
symbols, and we are done.
   Case B3: y is odd. Hence h = 4. As cu + dv = cu0 + dv0 − 4k, whether or not 2 || cu + dv is independent
of k. If 2 || cu + dv, then we see that incrementing k by 1 changes yu(cu + dv) + 1 by 4yu ≡ 4 (mod 8), i.e.
µ2 swaps sign. In particular, taking either all even k or all odd k causes µ2 to be constant as a function of
k. Picking k = 2k ′ to be even and applying the same trick as in Case B of Lemma 4.3 gives
                               u         c   cu + dv   (cu + dv )/8 − k ′ 
                                                    0       0    0     0
                                    = µ2                                           .
                                 v          d       2v2 (n)           no
                       n
As we have at least ⌊ 8xy ⌋ consecutive values of k ′ , we are done.
                                                                                                                             
  Again, we consider square numerators separately.
Lemma 4.6. Let x and y be coprime positive integers, and let n ≥ 8xy be an integral square satisfying n ≡ x
(mod gcd(y, 4)). Furthermore, assume that one of the following is true:
                                                                     16
                       
                         x
     • y is odd and      y   = 1;
                                      
                                       x
     • (x, y) ≡ (1, 0) (mod 4) and     y   = 1;
     • y ≡ 2 (mod 4);
Then n is a numerator in the orbit Ψ ( xy ).
Proof. The proof of Lemma 4.5 up to equation (4.0.7) is still valid. To summarize, we have a solution
u0 x + v0 y = n with u0 ≡ 1 (mod 4), where u0 > 0 is minimized. We are looking for pairs (u, v) = (u0 +
                                 n     u0
hyk, v0 − hxk) with 0 ≤ k ≤ hxy     − hy  with uv = 1, where h ∈ {1, 2, 4} is the smallest integer satisfying
4 | hy.
    Nonnegative integers c, d were chosen such that d ≡ no ≡ 1 (mod 4) (since no is still a square), xd−yc = 1,
and d is coprime to all possible u values. Since n is a square, (4.0.7) implies that
                                                       (              
                       u         c                     yu(cu+dv)+1
                                                                          if 2 || cu + dv;
                                                                2
                             = µ2      , where µ2 =
                         v          d                    1                else.
                                                                                                           
    Case 1: y 6≡ 2 (mod 4). Then by d ≡ 1 (mod 4), the proof of Lemma 3.1 applies to ( xc yd ), so uv =
      
µ2 dc = µ2 xy = µ2 .
   Case 1A: 4 | y. As in the proof of Lemma 4.5, µ2 = 1, and we are done.
   Case 1B: y is odd. If n is even, then gcd(cu + dv, n) = gcd(cu + dv, xu + yv) = gcd(u, v) is odd (as in
the proof of Lemma 4.5, Case A), hence we conclude cu + dv is odd, and therefore µ2 = 1. Otherwise, n ≡ 1
(mod 4), and
                   1 = xd − yc ≡ x − yc (mod 4), 1 ≡ n = ux + vy ≡ x + vy (mod 4).
This combines to yc + vy ≡ 0 (mod 4), so 4 | c + v, and thus cu + dv ≡ c + v ≡ 0 (mod 4), once again
implying that µ2 = 1.
   In both cases 1A and 1B we are done, because n ≥ xy, so the range of valid k is non-empty.
   Case 2: 2 || y. Hence h = 2, and n, x are odd. As n is a square, n ≡ 1 (mod 4), so 1 ≡ n ≡ ux+vy ≡ x+2v
(mod 4). Similarly, xd − yc = 1, so x + 2c ≡ 1 (mod 4), implying that v ≡ c (mod 2). In particular,
cu + dv = cu0 + dv0 − 2k is always even. Considering k = 0, 1, 2, 3, exactly two of these values
                                                                                                  will trigger
                                                                                                         
2 || cu + dv, and their values of µ2 will be opposite. In particular, one of them will give uv = µ2 dc = 1,
                                                               n     u0
proving that n is in the orbit. This will be valid as long as hxy − hy  ≥ 3, which follows from n ≥ 8xy.     

                                    5. Proof of Theorems 2.5 and 2.6
  Theorem 2.5 follows immediately from Lemma 3.4.
Proof ofTheorem 2.5. First, assume one of the first two conditions. By Lemma 3.4, if ( uv ) is in the orbit,
then uv = −1, hence neither u nor v can be a square.
   Now assume that (x, y) ≡ (3, 0) (mod 4). Since ax + by ≡ 3 (mod 4), it can never be a square, so it
suffices to check if cx + dy can be a square. If it is, then (cx + dy)o ≡ 1 (mod 4), whence by Lemma 3.4,
                                                                   
                              ax + by             o         x       −1     x
                                        = (−1)(y −1)/2          =             = −1,
                              cx + dy                       y        y     y
again a contradiction.                                                                                         
   This also gives the positive result for the reciprocity obstructions listed in Theorem 2.6. The necessity
of the congruence conditions follows immediately from Lemma 4.1. In order to prove that this completely
describes the orbit, we invoke the lemmas from Section 4 alongside an analytic input from Section 5.1.
5.1. Analytic lemma. For a positive non-square integer n, let f (n) denote the smallest positiveinteger m
such that in any sequence of m consecutive integers, there exists at least one value x for which nx = 1, and
one value y for which ny = −1. That is,
                                   n                         n x                   oo
                      f (n) = min m : ∀a ∈ Z, {−1, 1} ⊆             :a<x≤a+m .
                                                                n
We will require two upper bounds for f (n). The first one is a quick modification of the trivial bound f (n) ≤ n.
                                                       17
Lemma 5.1. Let n ≥ 5 be odd and not square. Then f (n) ≤ n − 1.
Proof. Let φ(n) denote Euler’s totient function, which denotes
                                                                  the number of positive integers up to n that
are coprime to n. As n is not a square, in the sequence n0 , n1 , . . . , n−1
                                                                            n  , there are exactly φ(n)/2 values
of 1, and the same number of −1’s. Thus if φ(n) ≥ 4, then any sequence of n − 1 numbers still has one with
Kronecker being −1, and one with Kronecker being 1. If n has a prime factor at least 5 then φ(n) ≥ 4, and
if 9 | n this this again holds. All odd n ≥ 5 satisfy at least one of these conditions, giving the result.     

   For large n, we require a better bound. If n ≥ 2.5 · 109 is prime, then Treviño shows that f (n) ≤
1.55n1/4 log n [Tn12, Theorem 1]. Since we require a result for non-primes as well, we need a new argu-
ment. Lemma 5.2 is good enough for our purposes, but presumably far from optimal (this function can be
computationally explored with kron seq both in [Ric23]).
Lemma 5.2. Let n ≥ 3.41 · 106 be a non-square integer with n 6≡ 2 (mod 4). Then
                                                  √
                                  f (n) ≤ 0.942836 n log n log log n.
                                                             6
Proof of Lemma 5.2. To begin, we will
                                     x
                                        assume n ≥ 3.41 · 10 everywhere. Define the non-principal Dirichlet
character of modulus n, χn (x) := n .
  An explicit upper bound for the Pólya-Vinogradov inequality given by Frolenkov and Soundararajan
[FS13, Corollary 1] states that for q ≥ 100, and χ a non-principal character of modulus q,

                                        X                                   
                                                          1 √             6    √
                      SM,N (χ) :=               χ(x) ≤    √ q log q + 1 + √     q.
                                    M<x≤M+N
                                                         π 2             π 2

   Under our assumptions that q = n and n ≥ 3.41 · 106 , we obtain
                                                         
                                    1      1            6      √             √
(5.1.1)            SM,N (χn ) ≤    √ +          1+ √             n log n ≤ c1 n log n,
                                  π 2    log n       π 2
where c1 ≈ 0.381338.                                                                                           
                                                                                                           x
   Let N = f (n) − 1, and consider a sequence of N consecutive integers M + 1, . . . , M + N for which   n       6= 1
(or for which nx 6= −1). Since nx = χn (x), there is no cancellation in SM,N (χn ), hence
(5.1.2)                      SM,N (χn ) ≥ #{x : M < x ≤ M + N, gcd(x, n) = 1}.
   To bound this, let gn (A) denote the number of integers from 1 to A that are coprime to n. A classic
formula (for example, see the proof of Theorem 8.29 of [NZM91]) gives that
                                      X                              
                                               A       φ(n) X           A
                             gn (A) =    µ(d)     =A       −     µ(d)      ,
                                               d         n              d
                                       d|n                         d|n

where µ(d) is the Möbius function and {x} = x − ⌊x⌋. In particular, we have
                                              φ(n)    X
                                   gn (A) − A      <     |µ(d)| ≤ 2ω(n) ,
                                               n
                                                            d|n

where ω(n) is the number of distinct prime factors of n. Combining this with (5.1.2) yields
                                                                 φ(n)
                           SM,N (χn ) ≥ gn (M + N ) − gn (M ) ≥ N     − 2ω(n)+1 .
                                                                  n
Using the upper bound (5.1.1) for SM,N and f (n) = N + 1 gives an upper bound of
                                                           
                   n              φ(n)    √            ω(n)+1       n            √                
(5.1.3)   f (n) ≤        c1 + 3/2          n log n + 2          ≤        0.381374 n log n + 2ω(n)+1 .
                  φ(n)         n log n                            φ(n)
             n
A bound for φ(n) can be found in Theorem 15 of [RS62]:
                                         n                    2.50637
                                             < eγ log log n +           ,
                                        φ(n)                  log log n
                                                       18
where γ ≈ 0.577216 is the Euler–Mascheroni constant. Using n ≥ 3.41 · 106 yields
                                        n
(5.1.4)                                     ≤ 2.122133 log log n.
                                       φ(n)
  The final ingredient is a bound of Robin (Théorème 13 of [Rob83]), which gives
                                                              log n
                                              ω(n) ≤                      .
                                                       log log n − 1.1714
Therefore
                                      2ω(n) ≤ nlog 2/(log log n−1.1714) ≤ n0.450254 .
This gives
                                                                                          
                     √            ω(n)+1
                                          √                                      2                        √
(5.1.5)      0.381374 n log n + 2        ≤ n log n 0.381374 +                                  ≤ 0.4442869 n log n.
                                                                         n0.049746 log n
  Combining (5.1.3), (5.1.4) and (5.1.5) gives
                                                          √
                                          f (n) ≤ 0.942836 n log n log log n,
proving Lemma 5.2.                                                                                                      
                                                                                                             x
                                                                                                               
Remark 5.3. The only change to covering the n ≡ 2 (mod 4) case would be that χn (x) =                        n     now has
modulus 4n instead of n, giving slightly worse bounds.
5.2. Proof of Theorem 2.6. As previously remarked, the necessity of the congruence conditions has been
shown, and the existence of the claimed reciprocity obstructions proven. It remains to show that all other
sufficiently large integers appear. The bulk ofj thekwork will come in applying Lemmas 4.3, 4.5, where for
                                                  n
n 6= m2 , 2m2 , it must be shown that f (no ) ≤ 8xy  .

Proof of Theorem 2.6. If x = 0 or y = 0, the result follows immediately from Corollary 4.2. Otherwise,
assume that x, y > 0, and assume that n is a non-square satisfying the congruence obstructions from Table 1.
   Next, also assume that n ≥ 2k r and n ≥ 2k · 3.41 · 106 , where
                                             √
                                               r
                                                       = 7.542795xy,
                                       log r log log r
and k = ⌊log2 8xy⌋. First, we show that r ≥ 30000xy. Let xy = a and assume r < 30000a =: Ca. Thus
                         a log r log log r            a log Ca log log Ca            log C log log C
          1 = 7.542795          √          > 7.542795        √            ≥ 7.542795      √          > 1.04,
                                  r                            Ca                            C
a contradiction. Therefore n ≥ 8r ≥ 240000xy.
   If n is twice a square, then we are done by Lemmas 4.3, 4.5. Otherwise, write n = 2w no , and assume first
that 2w ≥ 8xy. In this case,              
                                        n        n
                                             ≥      − 1 ≥ no − 1 ≥ f (no )
                                       8xy      8xy
by Lemma 5.1, assuming no ≥ 5. If no = 3, then n ≥ 240000xy implies
                                              
                                            n
                                                 ≥ 29999 ≥ 3 = f (no ).
                                           8xy
The result now follows from Lemmas 4.3, 4.5.
  If 2w < 8xy, then w ≤ k, hence no ≥ r and no ≥ 3.41 · 106 . Thus
                             
                           n       no               √
                                ≥     − 1 ≥ 0.942836 no log no log log no ≥ f (no ),
                          8xy     8xy
                                                                    o
                       √ follows from both lower bounds on n in the previous sentence, the definition
where the second inequality
of r, and the fact that r/ log r log log r is an increasing function, and the third inequality is Lemma 5.2.
Lemmas 4.3 and 4.5 again give the result.
   Finally, assume n ≥ 8xy is a square. Lemmas 4.4 and 4.6 fill in all cases where a reciprocity obstruction
was not claimed.                                                                                           
                                                            19
                                               6. An explicit orbit
   Since Theorem 2.6 is completely explicit, combining it with a computation allows us to completely describe
given orbits of Ψ. Theorem 2.8 provides the first example of a completely described orbit with reciprocity
obstructions.

Proof √
         of Theorem 2.8. Using the notation of Theorem 2.6, we have 8xy = 48, hence 2k = 32. From
        r                                          6                                8
log r log log r = 45.25677, we derive r ≥ 3.41 · 10 . Therefore if n ≥ 1.0912 · 10 is a non-square, then n
is a numerator in the orbit Ψ ( 23 ). We have a reciprocity obstruction, so squares do not occur, and thus it
suffices to compute the non-squares in the orbit up to 1.0912 · 108 . This can be done with Lemma 4.1. Code
to do this in under half a minute is found in [Ric23], in the method test psi 23orbit.                     

                     7. Subsemigroups of Ψ of Hausdorff dimension less than 1
7.1. Limit sets and Hausdorff dimensions for continued fraction semigroups. Recall that γ =
  a b                     1                                     ax+b
  c d ∈ SL(2, Z) acts on P (R) by Möbius maps, i.e. γ(x) = cx+d . Associated to any continued fraction
                       ≥0
semigroup Γ ⊆ SL(2, Z) is its limit set Λ(Γ):
                                  n                                 o
                          Λ(Γ) := lim γ0 · · · γn (1) : γj ∈ Γ \ {I} ⊆ (0, ∞).
                                        n→∞

Equivalently, one can allow γj from a generating set for Γ in the expression above. The Hausdorff dimension
of this limit set will be denoted δ(Γ).
   Our first goal is to show that the limit set of Ψ has Hausdorff dimension 1, which we approach by starting
with SL(2, Z)≥0 , and then Γ1 (4)≥0 .
Lemma 7.1. δ(SL(2, Z)≥0 ) = 1.
Proof. Let α = [a0 ; a1 , a2 , . . .] be a positive irrational number, and recall that elements of SL(2, Z)≥0 can be
expressed uniquely as words in L, R (with nonnegative powers). By (2.0.1) in Section 2,
                     x                                         x
                        = [a0 ; a1 , a2 , . . . , a2n−1 ] ⇔      = La0 Ra1 · · · La2n−2 Ra2n−1 −1 (1),
                     y                                         y
whence α ∈ Λ(SL(2, Z)≥0 ), and therefore δ(SL(2, Z)≥0 ) = 1.                                                      

   Given two elements γ1 , γ2 ∈ SL(2, Z)≥0 , we say that γ1 is an initial subword of γ2 if γ1−1 γ2 ∈ SL(2, Z)≥0 .
Equivalently, γ1 is an initial subword of γ2 if and only if γ2 ’s LR-word begins with γ1 ’s LR-word.
   We extend the definition of limit set to subsets Γ ⊆ SL(2, Z)≥0 , namely, Λ(Γ) is the collection of limits
limn→∞ γn (1) of all the chains of words γ0 ≤ γ1 ≤ · · · where γi ∈ Γ and a ≤ b indicates that a is an initial
subword of b. Write δ(Γ) = δ(Λ(Γ)), as before.
                                                                             S
Lemma 7.2. Let Γ ⊆ SL(2, Z)≥0 be a subsemigroup. Suppose that Γ = i Γi for some finite set of subsets
Γi ⊆ Γ. Suppose further that for all i, j there exists γi,j ∈ SL(2, Z)≥0 so that γi,j Γi ⊆ Γj . Then δ(Γi ) = δ(Γ).
Proof. Let α ∈ Λ(Γ), so that α = limn→∞ γ0 γ1 · · · γn (1). Considering all subwords γ0 γ1 · · · γn , there exists
some i for which infinitely many such subwords lie in Γi , hence α ∈ Λ(Γi ). Therefore
                                       [                    [
                                         Λ(Γi ) ⊆ Λ(Γ) ⊆       Λ(Γi ),
                                           i                      i

and equality follows. The Hausdorff dimension of a union is the supremum of the Hausdorff dimensions,
hence δ(Γ) = supi δ(Γi ). Furthermore,
                                        γi,j γj,i Λ(Γj ) ⊆ γi,j Λ(Γi ) ⊆ Λ(Γj )
  Therefore all the δ(Γi ) are equal (since Hausdorff dimension is preserved by Möbius transformation), and
equal to δ(Γ).                                                                                             

Proposition 7.3. δ(Ψ) = 1.
                                                          20
Proof. First, we show that δ(Γ1 (4)≥0 ) = 1. This uses Lemma 7.2, by observing that
                                                         [
                                      SL(2, Z)≥0 =                ΓM ,
                                                              M∈SL(2,Z)/Γ1 (4)

where ΓM = {γ ∈ SL(2, Z)≥0 : γ ≡ M (mod 4)}. Since δ(SL(2, Z)≥0 ) = 1 (by Lemma 7.1) and Γ1 (4)≥0 is a
union of ΓM ’s, we are done.
   Finally, δ(Ψ) = 1 also follows from Lemma 7.2, by observing that Γ1 (4)≥0 = Ψ∪Ψ′ , where Ψ′ = Γ1 (4)≥0 \Ψ.
If γ ∈ Ψ′ , then γΨ ⊆ Ψ′ and γΨ′ ⊆ Ψ by (3.0.1) in Section 3.                                              
                                                             
7.2. Iterated function systems. Given a matrix γ = ac db ∈ SL(2, Z)≥0 , associate to it
                                                                         
                                                        a−b           b
                                    Tγ := RγR−1 =                           .
                                                    a+c−b−d b+d
  Then Tγ : [0, 1] → [0, 1] is a conformal map, which is a contraction as long as γ is not the identity matrix.
Recall that SL(2, Z)≥0 = hL, Ri+ , and note
                                 1                                                  x
                     TL (x) =       : [0, 1] → [1/2, 1],                TR (x) =       : [0, 1] → [0, 1/2].
                                2−x                                                x+1
  For a non-empty subset W ⊆ SL(2, Z)≥0 not containing the identity, consider the set
                                                    CW := {Tγ : γ ∈ W}.
  If W is finite, then two things happen:
    (1) CW satisfies the open set condition: there exists an open set U ⊆ [0, 1] such that the images Tγ (U )
        for γ ∈ W are pairwise disjoint.
    (2) CW satisfies the bounded distortion property: there exists a KW ≥ 1 such that for all γ ∈ CW , and
        x, y ∈ [0, 1].
                                           |Tγ′ (x)| ≤ KW |Tγ′ (y)|.
Thus the set {Tγ : γ ∈ W} forms a conformal iterated function system. For details, see [MU96].
  To any such finite W, define the semigroups
                                                    +                                    +
                         ΓW := hγ : γ ∈ Wi ,               ΓR
                                                            W := hTγ : γ ∈ Wi = RΓW R
                                                                                      −1
                                                                                         .
  The limit set of a conformal iterated function system {Tγ : γ ∈ W} is defined as
                               ∞
                             [ \                                   ∞
                                                                   \        [
(7.2.1)                                     Tγ0 ···γn ([0, 1]) =                       Tγ0 ···γn ([0, 1]),
                            γ0 γ1 ··· n=1                          n=1 γ0 ,...,γn ∈W
                            γi ∈W

where the equality follows from the finiteness of the iterated function system. This definition coincides with
Λ(ΓR                                                 ∞
    W ) in our situation, as limn→∞ Tγ0 ···γn (1) = ∩n=1 Tγ0 ···γn ([0, 1]).
   Since the Hausdorff dimensions of Λ(ΓW ) and Λ(ΓR    W ) are equal, we can take advantage of the conformal
iterated function system setup of ΓR
                                   W   for  computation.

7.3. Hausdorff dimension of subsemigroups of Ψ (proof of Theorem 2.10). In this section, we show
that Ψ has finitely generated subsemigroups whose Hausdorff dimension approaches 1 from below, proving
Theorem 2.10. First, we give a hypothesis under which a finite subset W ⊆ SL(2, Z)≥0 gives rise to a limit
set of Hausdorff dimension strictly less than one. This becomes a consequence of the fact that the limit set
is a generalized Cantor set, which follows from the iterated function system formalism above.
Lemma 7.4. Let W ⊆ SL(2, Z)≥0 be a finite set of non-identity matrices, and assume that the sets Tγ ([0, 1])
with γ ∈ W are pairwise disjoint. Then δ(ΓW ) < 1.
Proof. Let W = {γ1 , . . . , γn }. We will show that the limit set of the iterated function system {Tγ : γ ∈ W} is
contained in a generalized Cantor set, as defined in Beardon [Bea65]. If so, Beardon guarantees the Hausdorff
dimension of the limit set is less than that of the interval, i.e. less than one [Bea65, Theorem 8].
                                                                   21
  With reference to [Bea65, Definition 1] and (7.2.1), we define ∆i0 ,··· ,ik := Tγi0 ···γik ([0, 1]), so
                                                        ∞
                                                        \        n
                                                                 [
                                           Λ(ΓR
                                              W) =                          ∆i1 ,··· ,ik .
                                                        k=1 i1 ,...,ik =1

The initial intervals are disjoint by assumption, and each interval ∆i0 ,...,ij contains further disjoint subinter-
vals ∆i0 ,...,ij ,ij+1 . By the bounded distortion property and assumption, we have two consequences concerning
the lengths |∆i0 ,...,ik | of the intervals ∆i0 ,...,ik :
    (1) There is an absolute constant 1 > A > 0 such that
                                              |∆i1 ,...,ik+1 | ≥ A|∆i1 ,...,ik |.
    (2) There is an absolute constant 1 > B > 0 such that for s 6= t,
                           min{|x − y| : x ∈ ∆i1 ,...,ik ,s , y ∈ ∆i, ...,ik ,t } ≥ B|∆i1 ,...,ik |.
This implies that we have constructed a generalized Cantor set.                                                    

   If we restrict our generators to Γ1 (4)≥0 , then the assumption of Lemma 7.4 can be phrased in terms of
initial subwords.
Lemma 7.5. Let γ1 , γ2 ∈ Γ1 (4)≥0 . Then Tγ1 ([0, 1]) ∩ Tγ2 ([0, 1]) 6= ∅ if and only if either γ1 is an initial
subword of γ2 or vice versa.
Proof. It is clear that Tγ1 ([0, 1]) and Tγ2 ([0, 1]) have an interior point in common if and only if one of γ1 and
γ2 is an initial subword of the other.                                                               ′ ′ 
   This leaves only the case that γ1 (i) = γ2 (j) for i, j ∈ {0, 1}. Let γ1 = ac db and γ2 = ac′ db ′ , and first
                            b        b′                                                ′          ′               k
assume i = j = 0. Thus b+d      = b′ +d ′ , and as these are reduced fractions, b = b and d = d . Thus γ1 = γ2 R
                                                              ′          ′               k
for some k ∈ Z. The case of i = j = 1 is similar: a = a and c = c , so γ1 = γ2 L .
                                                             ′
                                                    b
   Finally, assume i = 0 and j = 1, so that b+d        = a′a+c′ . Again, as these are reduced, b = a′ and so d = c′ .
Since our matrices are in Γ1 (4), this gives 1 ≡ d ≡ c′ ≡ 0 (mod 4), a contradiction.                             

Proposition 7.6. Ψ has finitely-generated subgroups Γ′n , n ≥ 4, of Hausdorff dimensions δn < 1 approaching
1.
Proof. Let
                                            
                                Sn = { ac db ∈ Ψ : a, b, c, d ≤ n},                Γ′n = hSn i+ .
If γ1 , γ2 ∈ Ψ are such that γ1 is an initial subword of γ2 , then we can write γ2 = γ1 γ3 with γ3 ∈ Γ1 (4)≥0 . By
(3.0.1), it follows that γ3 ∈ Ψ. Furthermore, if γ1 , γ2 ∈ Sn , then γ3 ∈ Sn as well.
   Therefore removing γ2 and repeating as needed, we can reduce Sn to a subset of non-identity matrices
Wn such that Γ′n = ΓWn , and no element of Wn is an initial subword of another element.
   By Lemma 7.5, the assumptions in Lemma 7.4 hold, so δ(Γ′n ) = δ(ΓWn ) < 1.
   Note that for any finite X ⊆ Ψ, ΓX ⊆ Γ′n for some n. Furthermore, the collection {Tγ : γ ∈ Wn } forms
an infinite conformal iterated function system, and by Theorem 3.15 of [MU96],
                                   1 = δ(Ψ) =          sup         δ(ΓX ) = lim δ(Γ′n ),
                                                  X⊆Ψ,|X|<∞                       n→∞

giving the result.                                                                                                 

   As a corollary to the proof, we observe that every finitely-generated subroup of Ψ has Hausdorff dimension
less than 1. Since Ψ has Hausdorff dimension 1, it is not finitely generated. This proves Proposition 2.9. As
a matter of interest, this can be proven constructively.
Lemma 7.7. Let
                                                    12k+1 4k
                                                                   
                                         Mk :=      12k+4 4k+1         ∈ Ψ,       k ≥ 0.
Then Mk has no non-trivial initial subword in Γ1 (4)≥0 . In particular, Ψ is not finitely generated.
                                                              22
Proof. Recall that SL(2, Z)≥0 is generated by L and R, with no relations. Observe that, in SL(2, Z) modulo
4, multiplication by L on the left induces a cycle of order 4 on R3 = ( 13 01 ):
                                                                           
                            1 0          0 1         3 2         2 3            1 0
                                     →          →           →          →
                            3 1          3 1         3 1         3 1            3 1
Hence Ln R3 ∈
            / Γ1 (4) for any n ≥ 0. Thus any word of the form
                                                              
                                                12k + 1     4k
                              Mk = RL4k R3 =                     ,            k ≥ 0,
                                                12k + 4 4k + 1
is not a product of two non-trivial subwords lying in Γ1 (4)≥0 . As Mk ∈ Ψ ⊆ Γ1 (4)≥0 , there can be no finite
set of generators for Ψ.                                                                                    
   The proof of Theorem 2.10 depends on Proposition 2.13, proven in the next section. In particular, to show
that an orbit avoiding squares is actually an example of a reciprocity obstruction, we need to control the
congruence obstructions, so that we know they are not themselves ruling out squares. An easy way to do
this is to begin with a finitely generated subsemigroup whose congruence obstructions are known. We define
and investigate a few in the next section.
Proof of Theorem 2.10. Note that Ψ1 ⊆ Γ′n ⊆ Ψ for all n ≥ 4 (Ψ1 is studied in the next section). By
Proposition 2.13, the congruence obstructions for Ψ1 and Ψ are identical, hence they hold for Γ′n as well. In
particular, any orbit Ψ ( xy ) that exhibits reciprocity obstructions ensures that Γ′n ( xy ) also exhibits reciprocity
obstructions.                                                                                                        

                                        8. Obstructions in Ψ1 and Ψ2
   While Ψ is not finitely generated, we can consider finitely generated subsemigroups. Recall the following
definitions from Section 2:
                                         +                                       +
                        +      1 1       1 0                           +      1 4       1 0
          Ψ1 = L, R4 =                ,           ,      Ψ2 = L4 , R 4 =            ,            .
                               0 1       4 1                                  0 1       4 1
   As subsemigroups of Ψ, their orbits avoid squares. However, this fact is most interesting when squares
are allowed by the congruence obstructions (turning them into reciprocity obstructions), and the Hausdorff
dimension is sufficiently large.
   For Ψ2 , by Corollary 2.17 (proven later this section), it suffices to compute the Hausdorff dimension for
continued fractions built from the alphabet 4Z+ . For this estimate, we thank Mark Pollicott for sharing with
us his code to rigorously compute the Hausdorff dimensions for alphabets built from arithmetic progressions;
see [PV22]. His code gives δ2 = 0.6045578 ± 10−7 .
   For Ψ1 , the Hausdorff dimension certainly meets or exceeds that of Ψ2 . For a simple non-rigorous estimate,
we assume a result in the nature of Hensley’s growth estimate (1.0.1) holds (from Section 1). We compute
the orbit of Ψ1 ( 11 ) up to 50000, and estimate the growth rate using a least squares regression. This is done
in the function test psi1 hdim in [Ric23], and results in the estimate of δ1 ≈ 0.719.
   We classify the possible congruence obstructions in the next section.
8.1. Strong approximation. We claim that any congruence obstruction in an orbit of Ψ1 occurs modulo
4, and of Ψ2 occurs modulo 16. In other words, we show an explicit strong approximation property with the
“bad modulus” being 22 or 24 , respectively.
   For a subgroup G of SL(2, Z) and a positive integer n, denote by G/n the image of the reduction map
ρn : G → SL(2, Z/nZ). The full statement of explicit strong approximation is as follows.
Theorem 8.1. Let i ∈ {1, 2}. Writing n = no n′ , with no odd and n′ a power of 2, we have:
  (1) For i = 1, 2, Ψi /n ∼
                          = Ψi /no × Ψi /n′ .
  (2) Ψi /n = SL(2, Z)/no .
           o

  (3) There exists an exponent ei ≥ 1 such that for all k ≥ ei ,
                                (Ψi /2k )/(Ψi /2ei ) = (SL(2, Z)/2k )/(SL(2, Z)/2ei ).
    (4) We have e1 = 2 and e2 = 4.
                                                          23
  The group SL(2, Z) has a multiplicative structure, as a consequence of strong approximation for SL(2, Z):
                         SL(2, Z)/mn ∼
                                     = SL(2, Z)/m × SL(2, Z)/n,         gcd(n, m) = 1.
Lemma 8.2. Let gcd(m, n) = 1, and let i ∈ {1, 2}. Then Ψi /mn ∼
                                                              = Ψi /m × Ψi /n.
Proof. We begin with Ψ2 . Using the multiplicative structure of SL(2, Z), suppose M ∈ SL(2, Z)/mn maps
to (M1 , M2 ) ∈ Ψ2 /m × Ψ2 /n. We wish to show M ∈ Ψ2 /mn. There exists words W1 and W2 in L4 and
R4 which descend to M1 modulo m and M2 modulo n, respectively. Note that the order of L4 (respectively
R4 ) modulo 2e N , for N odd, is N max(1, 2e−2 ). The orders of L4 (respectively, R4 ) modulo m and n are
therefore coprime. Thus, by the Chinese remainder theorem we can modify the exponents in W1 and W2 to
produce a single word W in L4 and R4 that reduces to M1 and M2 modulo m and n respectively. It is clear
that the Ψ1 case works mutatis mutandis.                                                               

Lemma 8.3. Let n be an odd positive integer. Then Ψ2 /n = Ψ1 /n = SL(2, Z)/n.
Proof. As n is odd, (L4 )k ≡ L (mod n) forsome k, hence
                                                        ρn (L) ∈ Ψ2 /n; similarly,ρn (R) ∈ Ψ2 /n. Therefore
SL(2, Z)≥0 /n ⊆ Ψ2 /n, including n2n−1 n1 ≡ −1  0 1
                                                   0   (mod n). But S := −1    0 1
                                                                                 0   together with L and R
generate SL(2, Z), giving Ψ2 /n = SL(2, Z)/n. The final conclusion is a result of the inclusions Ψ2 ⊆ Ψ1 ⊆
SL(2, Z).                                                                                                  

Lemma 8.4. Let e ≥ 5 be a positive integer, and let M ∈ SL(2, Z)/2e . Then M ∈ Ψ2 /2e if and only if
ρ16 (M ) ∈ Ψ2 /16.
Proof. We have a group
                             a b
                       G=      c d   : b ≡ c ≡ 0 mod 4, a ≡ d ≡ 1 mod 16 ⊆ SL(2, Z).
In particular, L4 , R4 ∈ G, and
                               in fact G/16 = Ψ2 /16.
   Now, assume    M   =   a b ∈ SL(2, Z)/2e satisfies ρ (M ) ∈ G/16. By possibly replacing M by R−4 M =
                         c d                          16
   a    b
 c−4a d−4b  , we   can assume   that v2 (c) = 2. Observe                           so there exists a k such
                                                          that v2 (4kc) = 4 + v2 (k),
that a + 4kc ≡ 1 (mod 2e ). Thus we replace M with L4k M = a+4kc         c
                                                                            b+4kd
                                                                              d
                                                                                   , so wecan assume a ≡ 1
(mod 2 ). Next, replacing M with R M for an appropriate ℓ, we can assume M = 10 db (mod 2e ). As this
       e                               4ℓ

has determinant 1, we observe that d ≡ 1 (mod 2e ), and in fact M ≡ Lb (mod 2e ). As ρ16 (M ) ∈ G/2e , b is
a multiple of 4, so b = 4b′ . Going back to our original element M , we have written
                                                                    ′
                                          M = R0 or 4 L−4k R−4ℓ L4b ,
so by choosing −k, −ℓ, b′ ≥ 0, we have written M as a word in L4 and R4 , proving that M ∈ Ψ2 /2e .          

Lemma 8.5. Let e ≥ 3 be a positive integer, and let M ∈ SL(2, Z)/2e . Then M ∈ Ψ1 /2e if and only if
ρ4 (M ) ∈ Ψ1 /4.
Proof. We have L, R4 ∈ Γ1 (4), and in fact Γ1 (4)/4 = Ψ1 /4. The proof is almost exactly as in the last lemma:
assume M := ac db ∈ SL(2, Z)/2e satisfies ρ4 (M ) ∈ Γ1 (4)/4, and write it as a word in L and R4 .           

Proof of Theorem 8.1. Lemmas 8.2, 8.3, and 8.4 combine to give the congruence obstructions for Ψ2 , while
Lemmas 8.2, 8.3, and 8.5 give the result for Ψ1 .                                                      

8.2. Reciprocity obstructions for Ψ1 and Ψ2 . We will now prove the next set of results from Section 2.
Proposition 2.12 gives orbits of Ψ1 and Ψ2 which exhibit reciprocity obstructions.

Proof of Proposition 2.12. By Theorem 8.1, the congruence obstructions in Ψ1 ( 23 ) occur modulo 4. Using
Ψ1 /4 = Γ1 (4)/4, it follows that the numerator has no congruence obstructions, and the missing squares
result in a reciprocity obstruction.
   For Ψ2 ( 38 ), the congruence
                                obstructions occur modulo 16. From the proof of Lemma 8.4, it suffices to
                               1 (mod 16) 0 (mod 4)
analyze the denominators of    0 (mod 4) 1 (mod 16)   ( 38 ), which comes out to be 0 (mod 4).               

  Proposition 2.13 states that Table 1 still holds for orbits of Ψ1 .
                                                       24
Proof of Proposition 2.13. By Theorem 8.1, the congruence obstructions in an orbit Ψ1 ( xy ) are controlled
by (x, y) (mod 4), and an easy computation shows they are exactly as described in Table 1. In particular,
the reciprocity obstructions predicted remain reciprocity obstructions, and the table remains unchanged. 

   If Table 1 does not predict a reciprocity obstruction (when squares are possible based on the congruence
obstructions), then we do not have a proof that the orbit Ψ1 ( xy ) does represent squares. In particular, we do
not know if Table 1 is complete for Ψ1 . The best we can do is compute a large number of orbits, and verify
that it appears to be complete.
   In the numerators/denominators of Ψ1 ( xy ) with 1 ≤ x, y ≤ 200, where a square was not ruled out by
congruence obstructions and a reciprocity obstruction was not predicted by Table 1, we found a square
numerator/denominator below 4002 in all cases. Code to reproduce this output is found in [Ric23] with
the function test table1 psi1 many. This data supports Conjecture 2.14, which predicts that Table 1 is
complete for Ψ1 .
   Finally, consider the orbit Ψ1 ( 23 ). By computing the numerators up to 107 , we observe that the final
missing non-square is 10569, lending support to Conjecture 2.15. This computation can be recreated with
test psi1 23orbit.

                                   9. Connection to continued fractions
   The final order of business is to prove Proposition 2.16 and the subsequent results, which connect the
orbits of Ψ1 , Ψ2 to continued fractions.

Proof of Proposition 2.16. Assume ( uv ) ∈ Ψ2 ( xy ), and write
                            ( uv ) = L4b0 R4b1 L4b2 R4b3 · · · L4b2m R4b2m+1 ( xy ) =: W1 ( xy ) ,
for nonnegative integers bi , where bi > 0 if 0 < i < 2m + 1. From the discussion at the start of Section 2, we
have
                                 ( xy ) = Ra1 La2 Ra3 · · · Ra2n−1 ( 10 ) =: W2 ( 10 ) ,
Thus ( uv ) = W1 W2 ( 10 ), and the even continued fraction of uv is the concatenation of W1 with W2 .
  It is clear that these steps are reversible, i.e. it is an if and only if. The case of Ψ1 ( xy ) follows in an
analogous fashion.                                                                                             

   Relying on the even continued fraction is a mildly annoying technicality caused by working with the words
in L, R. This can be removed by considering inverses of rational numbers.
Proposition 9.1. Let x < y be coprime nonnegative integers, and let xy = [0; a1 , a2 , . . . , an ] be a continued
fraction expansion. For coprime nonnegative integers u, v, we have either ( uv ) ∈ Ψ2 ( xy ) or ( uv ) ∈ Ψ2 ( xy ) if
and only if uv has a continued fraction of the form
                             u
                                = [4b0 ; 4b1 , 4b2 , . . . , 4bm−1 , 4bm + a1 , a2 , . . . , an ],
                             v
where the bi are nonnegative integers with bi > 0 if 1 ≤ i ≤ m − 1.
Proof. If x = 0, we must have 10 = [0], and the condition of either ( uv ) or ( uv ) is in Ψ2 ( 01 ) is equivalent to
either ( uv ) or ( uv ) is in Ψ2 ( 10 ). The condition that uv has a continued fraction involving only multiples of 4 is
equivalent to either uv or uv has an even continued fraction involving only multiples of 4, and Proposition 2.16
finishes this case.
   Now assume x > 0, and note that if uv takes the above form, then it will still take this form if we use the
other continued fraction expansions of uv and xy . Therefore we can assume that n is odd, i.e. we took the
even continued fraction expansion of xy .
   If c0 > 0, note that
                                                         1
                                                                          = [0; c0 , c1 , . . . , ck ].
                                             [c0 ; c1 , c2 , . . . , ck ]
In particular, if uv takes the assumed form, possibly replacing uv by uv allows us to assume the total length is
even, and therefore we fall under the purview of Proposition 2.16, proving the result.                                
                                                             25
   Corollary 2.17 follows immediately from Proposition 9.1.
   Theorem 2.18 follows from checking the congruence obstructions for ΨA ( xy ) in the relevant cases, as
follows.
Lemma 9.2. Let A be a subset of 4Z+ containing 4, 8, and let x, y be odd. Then the congruence obstruction
on a denominator d of ΨA ( xy ) is d ≡ x or y (mod 4).
Proof. Write Ca = ( 01 a1 ), and U = ( 01 10 ). We have that
                 Ψ2A := hCa Cb : a, b ∈ Ai+ = hU La Rb U : a, b ∈ Ai+ ⊆ U Ψ2 U = Ψ2 ⊆ SL(2, Z).
Claim: For any modulus m, Ψ2 /m = Ψ2A /m.
  Indeed, let m be a modulus. Within SL(2, Z/mZ), the semigroup generated by a list of generators is the
same as the group generated by those generators. Therefore, Ψ2A /m contains
                                   C8 C4 (C4 C4 )−1 = R4 ,             (C4 C4 )−1 C4 C8 = L4 .
Hence Ψ2 /m ⊆ Ψ2A /m ⊆ Ψ2 /m, which proves the claim.
    As a consequence, we know the congruence obstructions for Ψ2A are those of Ψ2 . A denominator of ΨA ( xy )
is a denominator of either Ψ2A ( xy ) or Ψ2A Ca ( xy ) for some a ∈ A. Congruence obstructions for Ψ2 occur modulo
16, and the proof of Lemma 8.4 gives that
                                                                                 
                                                1 4b
                               Ψ2 /16 =                      (mod 16) : 0 ≤ b, c ≤ 3 .
                                               4c 1
Thus the denominators in Ψ2A ( xy ) are y (mod 4), and the denominators in Ψ2A Ca ( xy ) are x (mod 4), finishing
the proof.                                                                                                      
Proof of Theorem 2.18. By Lemma 9.2, the denominators of ΨA ( xy ) have congruence obstruction either 1
(mod 4) or 1 (mod 2), both of which admit squares. Thus, it suffices to show that the denominator cannot
be a square.
   Next, ( uv ) ∈ ΨA ( xy ) if and only if we can write the continued fraction for uv as
                                       [0; b1 , b2 , . . . , bn−1 , bn + a0 , a1 , . . . , an ],
where xy = [a0 ; a1 , a2 , . . . , an ] and bi ∈ A for all i.
   By Proposition 9.1, this implies that either ( uv ) or ( uv ) is in the orbit of Ψ2 ( xy ) or Ψ2 ( xy ) (the second case
occurs when a0 > 0, and one considers xy = [0; a0 , a1 , . . . , an ] instead). Due to the symmetry of Ψ2 , we see
that if v is a denominator in ΨA ( xy ), then it is either                                                 x
                                                                a numerator or denominator in Ψ2 ( y ), hence Ψ ( y )
                                                                                                                         x

                                                                 x
as well. By Theorem 2.5 and the assumption that                  y     = −1, v is not a square, as claimed.             

   Specializing Theorem 2.18 to ΨA ( 35 ) gives Corollary 2.19. For the second equivalent phrasing, we need
only observe that
                                L(ΨA ( 01 )) = (2 3)ΨA ( 01 ) = (0 1)ΨA ( 23 ) ,
                                     Finally, let’s consider the more general Corollary 2.21, which comes
since ΨA is invariant under transpose.
                                 3
about by taking the orbits of 2+3k    for all k ≥ 0.
                                                                                                               
Proof of Corollary 2.21. We have uv = [0; 4a1 , 4a2 , . . . , 4an , k, 1, 2] if and only if ( uv ) ∈ Ψ4Z+ 2+3k
                                                                                                            3
                                                                                                                 . Fol-
lowing the final analysis of the proof of Lemma 9.2, we see that there are no congruence obstructions              on
                                                                                                      3
the denominator. From the proof of Theorem 2.18, it suffices to show that the orbits Ψ 2+3k               never admit
squares in the numerator or denominator. This follows from an analysis of Table 1 with the four values of
k (mod 4). The numerator is always 3 (mod 4), and thus not a square by congruence. The denominator is
not a square if k = 0, 3 (mod 4) by a congruence obstruction, and it is not a square if k = 1, 2 (mod 4) by
a reciprocity obstruction.                                                                                           
  All continued fractions of the form [0; 4a1 , 4a2 , . . . , 4an , an+1 , 1, 2] with denominator bounded by B can
be enumerated by a depth first search. This is implemented in the function contfrac tail missing, and
parallelized in the method cfracsearch in [Ric23]. A lengthy computation up to B = 2 × 1013 (mostly done
on 64 cores, for a rough total of 150000 CPU hours) yields fewer and fewer missing denominators, finally
                                                                  26
stopping around 7.97 × 1012 . The final missing denominators found in each equivalence class modulo 4 are
listed in Table 2.

          Table 2. Non-square d which are not denominators of numbers of the form
          [0; 4a1 , 4a2 , . . . , 4an , an+1 , 1, 2] up to B = 2 × 1013 .

                           d (mod 4) Total missing Largest missing ≈ B/Largest
                               0          2869016 2281020902160           8.77
                               1          1028567   674124164325         29.67
                               2          6654884 7968219670470           2.51
                               3             9665      2308640415      8663.11

   In particular, Conjecture 2.22 seems plausible.

                       10. Subgroups of SL(2, Z) with reciprocity obstructions
  We end with a few remarks about the case of groups (instead of semigroups). In Section 4 of [Kon13],
Kontorovich studies a thin orbit arising from Pythagorean triples, in particular from the group
                                                    
                                          1 2       1 0
                              Γ̃ := ±           ,±           = ±L2 , ±R4 .
                                          0 1       4 1
This group sits between the groups generated by Ψ1 and Ψ2 . The denominators of Ψ2 ( 38 ) are restricted to
be 0 (mod 4) and not square. However, Γ̃ ( 38 ) can have square denominators:
                                                                
                                       4 −2 4 −2 3              75
                                      R L R L              =         .
                                                        8      256
   This discussion raises a question: is our restriction to semigroups essential?
   The failure of our approach for groups is the inevitable involvement of the place at        infinity. Roughly
speaking, quadratic reciprocity says, for non-negative numbers, that the behaviour of x· is the same as the
                 
behaviour of x· . Our semigroup orbits involve only non-negative integers. However, −1        x
                                                                                                   tracks the sign
           −1
                       o                                                   4 −2 3        −13
                                                                                              
of x, and x     tracks x   (mod  4). The  example   above is instructive: R  L    (   ) =      , so both numbers
                                                                                 8     −44
have dipped into the negatives. At this point, we still have 83 = −1 = −13     −44 , but after one application of
                                    
  −2          75                  75
L we get −44 , where now −44 = 1.

Question 10.1. Do there exist subgroups of SL(2, Z) that exhibit reciprocity obstructions?
   A response to this question would require a precise formulation of the notion of reciprocity obstruction.

                                                      References
[Bea65]    A. F. Beardon. On the Hausdorff dimension of general Cantor sets. Proc. Cambridge Philos. Soc., 61:679–694, 1965.
[BK10]     Jean Bourgain and Alex Kontorovich. On representations of integers in thin subgroups of SL2 (Z). Geom. Funct.
           Anal., 20(5):1144–1174, 2010.
[BK14a]    Jean Bourgain and Alex Kontorovich. On the local-global conjecture for integral Apollonian gaskets. Invent. Math.,
           196(3):589–650, 2014. With an appendix by Péter P. Varjú.
[BK14b]    Jean Bourgain and Alex Kontorovich. On Zaremba’s conjecture. Ann. of Math. (2), 180(1):137–196, 2014.
[BK18]     Jean Bourgain and Alex Kontorovich. Beyond expansion IV: Traces of thin semigroups. Discrete Anal., pages Paper
           No. 6, 27, 2018.
[BS20]     Oscar F. Bandtlow and Julia Slipantschuk. Lagrange approximation of transfer operators associated with holomor-
           phic data. https://arxiv.org/abs/2004.03534, 2020.
[Con97]    John H. Conway. The sensual (quadratic) form, volume 26 of Carus Mathematical Monographs. Mathematical
           Association of America, Washington, DC, 1997. With the assistance of Francis Y. C. Fung.
[FK14]     Dmitrii A. Frolenkov and Igor D. Kan. A strengthening of a theorem of Bourgain-Kontorovich II. Mosc. J. Comb.
           Number Theory, 4(1):78–117, 2014.
[FS11]     Elena Fuchs and Katherine Sanden. Some experiments with integral Apollonian circle packings. Exp. Math.,
           20(4):380–399, 2011.
                                                             27
[FS13]    D. A. Frolenkov and K. Soundararajan. A generalization of the Pólya-Vinogradov inequality. Ramanujan J.,
          31(3):271–279, 2013.
[FSZ19]   Elena Fuchs, Katherine E. Stange, and Xin Zhang. Local-global principles in circle packings. Compos. Math.,
          155(6):1118–1170, 2019.
[GLM+ 03] Ronald L. Graham, Jeffrey C. Lagarias, Colin L. Mallows, Allan R. Wilks, and Catherine H. Yan. Apollonian Circle
          Packings: Number Theory. J. Number Theory, 100(1):1–45, 2003.
[Hat22]   Allen Hatcher. Topology of numbers. American Mathematical Society, Providence, RI, [2022] ©2022.
[Hen90]   Doug Hensley. The distribution of badly approximable rationals and continuants with bounded digits. II. J. Number
          Theory, 34(3):293–334, 1990.
[Hen96]   Douglas Hensley. A polynomial time algorithm for the Hausdorff dimension of continued fraction Cantor sets. J.
          Number Theory, 58(1):9–45, 1996.
[HKRS23] Summer Haag, Clyde Kertzer, James Rickards, and Katherine E. Stange. The local-global conjecture for apollonian
          circle packings is false. https://arxiv.org/abs/2307.02749 , 2023.
[Hua15]   ShinnYih Huang. An improvement to Zaremba’s conjecture. Geom. Funct. Anal., 25(3):860–914, 2015.
[Kan22]   I. D. Kan. Strengthening of the Bourgain-Kontorovich theorem on small values of Hausdorff dimension. Funct. Anal.
          Appl., 56(1):48–60, 2022. Translation of Funktsional. Anal. i Prilozhen. 56 (2022), no. 1, 66–80.
[Kon13]   Alex Kontorovich. From Apollonius to Zaremba: local-global phenomena in thin orbits. Bull. Amer. Math. Soc.
          (N.S.), 50(2):187–228, 2013.
[Kon16]   Alex Kontorovich. Applications of thin orbits. In Dynamics and analytic number theory, volume 437 of London
          Math. Soc. Lecture Note Ser., pages 289–317. Cambridge Univ. Press, Cambridge, 2016.
[Kon19]   Alex Kontorovich. The local-global principle for integral Soddy sphere packings. J. Mod. Dyn., 15:209–236, 2019.
[KZ23]    Alex Kontorovich and Xin Zhang. On length sets of subarithmetic hyperbolic manifolds. Math. Ann., 2023.
                                                               √
[Mil17]   Djordjo Milovic. On the 16-rank of class groups of Q( −8p) for p ≡ −1 mod 4. Geom. Funct. Anal., 27(4):973–1016,
          2017.
[MU96]    R. Daniel Mauldin and Mariusz Urbański. Dimensions and measures in infinite iterated function systems. Proc.
          London Math. Soc. (3), 73(1):105–154, 1996.
[Nie78]   Harald Niederreiter. Quasi-Monte Carlo methods and pseudo-random numbers. Bull. Amer. Math. Soc., 84(6):957–
          1041, 1978.
[NZM91] Ivan Niven, Herbert S. Zuckerman, and Hugh L. Montgomery. An introduction to the theory of numbers. John Wiley
          & Sons, Inc., New York, fifth edition, 1991.
[PAR23]   The      PARI      Group,     Univ.    Bordeaux.     PARI/GP       version     2.16.1,      2023.    available    from
          https://pari.math.u-bordeaux.fr/.
[PS23]    Mark Pollicott and Julia Slipantschuk. Effective estimates of ergodic quantities illustrated on the Bolyai-Rényi map.
          https://arxiv.org/abs/2308.04293, 2023.
[PV22]    M. Pollicott and P. Vytnova. Hausdorff dimension estimates applied to Lagrange and Markov spectra, Zaremba
          theory, and limit sets of Fuchsian groups. Trans. Amer. Math. Soc. Ser. B, 9:1102–1159, 2022.
[Rap14]   Andrei S. Rapinchuk. Strong approximation for algebraic groups. In Thin groups and superstrong approximation,
          volume 61 of Math. Sci. Res. Inst. Publ., pages 269–298. Cambridge Univ. Press, Cambridge, 2014.
[Ric23]   James Rickards. Semigroup-Reciprocity. https://github.com/JamesRickards-Canada/Semigroup-Reciprocity,
          2023.
[Rob83]   Guy Robin. Estimation de la fonction de Tchebychef θ sur le k-ième nombre premier et grandes valeurs de la fonction
          ω(n) nombre de diviseurs premiers de n. Acta Arith., 42(4):367–389, 1983.
[RS62]    J. Barkley Rosser and Lowell Schoenfeld. Approximate formulas for some functions of prime numbers. Illinois J.
          Math., 6:64–94, 1962.
[Ser85]   Caroline Series. The modular surface and continued fractions. J. London Math. Soc. (2), 31(1):69–80, 1985.
[SP80]    Rainer Schulze-Pillot. Darstellung durch Spinorgeschlechter ternärer quadratischer Formen. J. Number Theory,
          12(4):529–540, 1980.
[Tn12]    Enrique Treviño. On the maximum number of consecutive integers on which a character is constant. Mosc. J. Comb.
          Number Theory, 2(1):56–72, 2012.
[Zar72]   S. K. Zaremba. La méthode des “bons treillis” pour le calcul des intégrales multiples. In Applications of number
          theory to numerical analysis (Proc. Sympos., Univ. Montréal, Montreal, Que., 1971), pages 39–119. Academic
          Press, New York-London, 1972.
[Zha18]   Xin Zhang. On the local-global principle for integral Apollonian 3-circle packings. J. Reine Angew. Math., 737:71–
          110, 2018.

   Saint Mary’s University, Halifax, Nova Scotia, Canada
   Email address: james.rickards@smu.ca
   URL: https://jamesrickards-canada.github.io/

   University of Colorado Boulder, Boulder, Colorado, USA
   Email address: kstange@math.colorado.edu
   URL: https://math.katestange.net/



                                                              28
