1 Introduction

This article concerns a generalization of Markov numbers. Markov numbers appear in tuples which are solutions to a certain Diophantine equation.

Definition 1

A Markov triple is a tuple, (abc), of positive integers which satisfy \(a^2 + b^2 + c^2 = 3abc\). A number which appears in at least one Markov triple is called a Markov number. We call \(x^2 + y^2 + z^2 = 3xyz\) the Markov equation.

Markov triples and numbers first appeared in Markov’s theorem in [20]. They have remained of interest to mathematicians ever since, in no small part due to Frobenius’ famous Uniqueness Conjecture which remains open to this day [15]. This conjecture states that each Markov number is the largest number in a unique Markov triple. For a history of work on this conjecture, see [1].

The tuple (1, 1, 1) is a natural first example of a Markov triple. We can construct more Markov triples by the following observation. Given a Markov triple (abc), we can replace c with \(\frac{a^2 + b^2}{c}\) to obtain a distinct Markov triple, \((a,b, \frac{a^2 + b^2}{c})\). This process is an example of Vieta jumping. It is clear that \(\frac{a^2 + b^2}{c}\) is positive, and since \(3ab - c^2 = \frac{a^2 + b^2}{c}\), we also know this new number is an integer. Note that this process is an involution, and that we could similarly replace a or b with this method. Furthermore, one can show that every Markov triple is the result of applying a sequence of Vieta jumping to the Markov triple (1, 1, 1). A complete proof can be found in [3].

The process of going from a Markov triple (abc) to another of the form \((a,b,\frac{a^2 + b^2}{c})\) is reminiscent of mutation in a cluster algebra. In [5] and [23], the respective authors explain the connection between Markov numbers and the cluster algebra arising from a once-punctured torus. Every triangulation of a once-punctured torus has three arcs and has adjacency quiver \(Q_T\) (known as the Markov quiver), given below.

figure a

More precisely, Markov numbers exactly correspond to the cluster variables in the cluster algebra from the Markov quiver when we set all initial cluster variables to 1. Since this cluster algebra arises from a surface, we can also interpret Markov numbers as the number of perfect matchings of snake graphs, as were defined in [21]. Recall that a perfect matching of a graph \(G = (V,E)\) is a subset of the edge set \(P \subseteq E\) such that every vertex is incident to exactly one edge in P. The snake graphs which correspond to Markov numbers were studied in detail in [9].

In this paper, we study solutions to a Diophantine equation inspired by the Markov equation and its connection to the theory of cluster algebras. We refer to our equation as the generalized Markov equation although there are many other interesting ways to generalize the equation.

Definition 2

The generalized Markov equation is

$$\begin{aligned} x^2 + y^2 + z^2 + xy + xz + yz = 6xyz. \end{aligned}$$

A generalized Markov triple is a tuple of positive integers (abc) satisfying the generalized Markov equation. If m is an element of at least one generalized Markov triple, we call m a generalized Markov number.

Generalized Markov triples and numbers were studied by Gyoda in [17] and in a broader context by Gyoda and Matsushita in [18]. In particular, it is shown in [17] that all generalized Markov triples can be reached from the triple (1,1,1) by exchanges similar to those used for the ordinary Markov equations.

Theorem 1

([17], Theorem 1.1) Every generalized Markov triple can be reached from the tuple (1, 1, 1) by a sequence of exchanges of the form \((a,b,c) \rightarrow (a,b,\frac{a^2 + ab + b^2}{c})\).

The form of these exchanges resembles mutation in a generalized cluster algebra, in the sense of Chekhov and Shapiro [11]. The relevant generalized cluster algebra, \(\mathcal {A}_3\), arises from a once-punctured sphere with three orbifold points, which we will denote \(\mathcal {O}_3\). In parallel to the case of ordinary Markov numbers, generalized Markov numbers are given by generalized cluster variables in \(\mathcal {A}_3\) when we specialize the initial cluster variables to 1. By following the construction of snake graphs from orbifolds in [4], we can again interpret these generalized Markov numbers as the number of perfect matchings of snake graphs. This is the perspective we will take.

Throughout the article, we will compare the features of our generalized Markov numbers with the ordinary Markov numbers. In our combinatorial context, it appears that generalized Markov numbers have the same nice properties as the ordinary case. We believe that further work on these numbers would unveil even further similar properties and patterns. For instance, in [19], the authors prove a conjecture from [1] concerning orderings on Markov numbers. We believe that the constructions in our paper could show the same conjecture is true in our setting. In particular, the extension of our algorithm in Sect. 5 was inspired by calculations in [19] and would likely play a role in proving these orderings hold for the generalized Markov numbers.

In Sect. 2, we briefly give some of the background needed to explore our results. This includes discussion of snake graphs, continued fractions, and the labeling of ordinary Markov numbers via rational numbers q such that \(0 \le q \le 1\). We will not define cluster algebras as the main results can be given without reference to cluster algebras. We direct a reader instead to the original papers on ordinary [14] and generalized cluster algebras [11] as well as a survey on ordinary cluster algebras by Glick and Rupel [16].

Our first main result is an algorithm to compute the number of perfect matchings of these snake graphs via continued fractions. The algorithm is outlined in Sect. 3, with the proof that it gives the correct continued fraction given in Theorem 6. We use properties of these continued fractions to give both recurrences and growth behavior for certain sequences within the set of all generalized Markov numbers in Sect. 4. The generalized Markov numbers correspond to arcs (with no self-intersection) on the orbifold associated to \(\mathcal {A}\); in Sect. 5, we consider generalized arcs (i.e. those with possibly self-intersection) and closed curves on this orbifold. Our final result in this section is Theorem 5, which gives recurrences on this extended family of numbers. In order to compute this recurrence, we provide Proposition 7, which gives a formula for computing the number of perfect matchings of a band graph, and Theorem 8, which computes the number of good matchings of certain band graphs coming from the orbifold \(\mathcal {O}_3\). Finally, in Sect. 6, we give suggestions for how our work could possibly be extended to solutions of similar Diophantine equations.

2 Background

2.1 Labeling Markov numbers with rational numbers

There is a convenient labeling of Markov numbers larger than 1 using rational numbers in the interval (0, 1]. One way to illustrate this labeling is by viewing triangulations and arcs on the universal cover of the once-punctured torus, \(\mathbb {Z}^2\). If our initial triangulation is \(T_0 = \{\tau _1,\tau _2,\tau _3\}\), with \(\tau _2\) following \(\tau _1\) in clockwise order, then we can lift \(\tau _1\) to all line segments of the form \(y = -x + a\), \(\tau _2\) to all line segments of the form \(x = b\), and \(\tau _3\) to all line segments of the form \(y = c\) for \(a,b,c \in \mathbb {Z}\), where we consider segments between two consecutive lattice points. We will say these lines, and the arcs in the once-punctured torus which they represent, have slopes \(\frac{-1}{1}, \frac{1}{0}, \frac{0}{1}\) respectively, and we descriptively rename them \(\tau _{\frac{-1}{1}}, \tau _{\frac{1}{0}}, \tau _{\frac{0}{1}}\).

figure b

We associate our initial triangulation \(\{\tau _{\frac{-1}{1}},\tau _{\frac{1}{0}},\tau _{\frac{0}{1}}\}\) to the Markov triple (1, 1, 1). We can apply Vieta jumping to any number in this Markov triple to reach (1, 1, 2). For the arcs, we pick the convention that we flip \(\tau _{\frac{-1}{1}}\). The flip of \(\tau _{\frac{-1}{1}}\) will have slope \(+1\) in the cover. Thus, we have that the Markov number labeled by \(\frac{1}{1}\), \(n_{\frac{1}{1}}\), is 2.

figure c

Since Vieta jumping is an involution, at the Markov triple (1, 1, 2) we must apply Vieta jumping to one of the entries of 1, reaching (1, 2, 5). In the triangulation \(\{\tau _{\frac{1}{1}},\tau _{\frac{1}{0}},\tau _{\frac{0}{1}}\}\), we pick the convention that we will flip \(\tau _{\frac{1}{0}}\), which was associated with lines of slope \(\frac{1}{0}\). The resulting new arc will have slope \(\frac{1}{2}\). From this we have \(n_{\frac{1}{2}} = 5\).

figure d

At this point, if we continue to flip arcs in the torus and do not flip the same arc two times in a row, their lifts will always have slope less than 1. This is a consequence of the following lemma.

Lemma 1

  1. 1.

    The set of slopes of each triangulation of the once-punctured torus are of the form \(\{ \frac{a}{c}, \frac{a+b}{c+d}, \frac{b}{d}\}\).

  2. 2.

    Mutation has the following effect on the slopes of a triangulation

    $$\begin{aligned}\{ \frac{a}{c}, \frac{a+b}{c+d}, \frac{b}{d}\} \rightarrow \{ \frac{(a+b) + b}{(c+d) + d}, \frac{a+b}{c+d}, \frac{b}{d}\}\end{aligned}$$

The operation of combining \(\frac{a}{c}\) and \(\frac{b}{d}\) to \(\frac{a+b}{c+d}\) is referred to as a Farey sum. Triangles of the form mentioned in Lemma 1 form the Farey tesselation of the upper-half plane.

We display the exchange trees for Markov numbers and rational numbers with respect to Vieta jumping and the Farey sum respectively in Figure 1. For example, we can see that \(n_{\frac{2}{3}} = 29\) by noting the positions where \(\frac{2}{3}\) and 29 first appear in each tree. Çanakçı and Schiffler discuss a combinatorial way to compute the Markov number associated to each rational number in [9].

Fig. 1
figure 1

The initial portions of the exchange trees for Markov Numbers and \(\mathbb {Q}\cap (0,1)\)

Since all generalized Markov numbers are also reachable by a sequence of Vieta jumping, we can also index generalized Markov numbers larger than 1 with rational numbers in the interval (0, 1]. By comparing Figures 1 and 2, we can for instance see that the generalized Markov number associated to \(\frac{2}{3}\), \(m_{\frac{2}{3}}\), is 217. In Sect. 3, we will give a direct way to compute \(m_{\frac{p}{q}}\).

Fig. 2
figure 2

The initial portions of the exchange tree for generalized Markov triples

2.2 Snake graphs on surfaces and orbifolds

Consider a connected, oriented 2-dimensional Riemann surface S with a finite subset M of points called marked points, and pick a triangulation T of the surface. As is thoroughly studied in [12] and [13], we can associate a cluster algebra to the tuple (SM), such that the arcs are in bijection with cluster variables; in particular, arcs in T are associated to initial cluster variables. In [21], Musiker, Schiffler, and Williams gave a direct way to compute the cluster variable \(x_\gamma \) associated to the arc \(\gamma \) via an edge-labeled graph called a snake graph. If \(\gamma \) crosses arcs \(\tau _{i_1},\ldots , \tau _{i_d}\) in the triangulation T, then the snake graph \(G_{\gamma ,T}\) consists of d square tiles, \(G_1,\ldots ,G_d\), glued along edges. The tile \(G_j\) represents the quadrilateral around the arc \(\tau _{i_j}\) in T. Then, we can calculate \(x_\gamma \) with respect to the initial cluster associated to T by looking at all perfect matchings of \(G_{\gamma ,T}\). In the following, \(\text {cross}(\gamma ,T)\), x(P) is the product of the weights of the edges in P, and y(P) is another statistic associated to a perfect matching. We do not dwell on these details as they will not be necessary for our main results.

Theorem 2

([21], Theorem 4.9) Given a triangulation T on a surface with marked points (SM), let \(\gamma \) be an arc on (SM). Then, the expansion of the cluster variable \(x_\gamma \) in the cluster algebra arising from (SM) with initial cluster from T is given by

$$\begin{aligned} x_\gamma ^T = \frac{1}{\text {cross}(\gamma ,T)} \sum _{P} x(P)y(P) \end{aligned}$$

where we sum over perfect matchings P of \(G_{\gamma ,T}\).

For an example of a snake graph, see Figure 3.

2.3 Orbifolds

An orbifold is a generalization of a manifold where the local structure is given by quotients of open subsets of \(\mathbb {R}^n\) under finite group actions. For our considerations, an orbifold (SMQ) is a marked surface with an additional set of special points called orbifold points Q. Each orbifold point comes with an order \(p \in \mathbb {Z}_{\ge 2}\). Arcs in an orbifold have endpoints in M and cannot pass through orbifold points. An arc which cuts out an unpunctured monogon with exactly one point in Q is called a pending arc.

Part of the story about cluster algebras from surfaces was extended to orbifolds by Chekhov and Shapiro in [11]. The relevant algebra is a generalized cluster algebra. These cluster algebras are generalized in the sense that the exchange polynomials can have more than 2 terms. A generalized cluster algebra arising from an orbifold will have exchange polynomials with 2 or 3 terms; the number of terms depends on whether the variable corresponds to a standard arc or a pending arc. In particular, in the generalized cluster algebra arising from \(\mathcal {O}_3\), the exchange polynomials are all of the form \(u+v\) or \(u^2 + uv + v^2\). The snake graph expansion formula was extended to generalized cluster variables in a generalized cluster algebra from an orbifold by the first author and Elizabeth Kelley [4].

Theorem 3

([4], Theorem 1.1) Given a triangulation T on an orbifold \(\mathcal {O}\), let \(\gamma \) be an arc on \(\mathcal {O}\). Then, the expansion of the generalized cluster variable \(x_\gamma \) in the cluster algebra arising from \(\mathcal {O}\) with initial cluster from T is given by

$$\begin{aligned} x_\gamma ^T = \frac{1}{\text {cross}(\gamma ,T)} \sum _{P} x(P)y(P) \end{aligned}$$

where we sum over perfect matchings P of \(G_{\gamma ,T}\).

In this paper we specifically consider the orbifold \(\mathcal {O}_3\), a sphere with one puncture and three orbifold points of order three. Every triangulation of \(\mathcal {O}_3\) consists of three pending arcs which are all based at the unique marked point. Arcs on an orbifold can be flipped just as arcs on a surface; moreover, a flip of a pending arc will always be another pending arc. Thus we see that the only effect that a flip has on the initial triangulation on \(\mathcal {O}_3\) is flipping the relative orientation of the arcs in the triangulation, just as in the case of a once-punctured torus.

figure e

The combinatorics of the orbifold \(\mathcal {O}_3\), Theorem 1 and Theorem 3 allow us to interpret the generalized Markov numbers and tuples in terms of a generalized cluster algebra. Given a graph G, let \(\eta (G)\) be the number of perfect matchings of G.

Corollary 1

([17], Corollary 3.9) Let \(\gamma _1,\gamma _2,\gamma _3\) be a triangulation of \(\mathcal {O}_3\).

  • For any i, the number \(\eta (G_{\gamma _i,T})\) is a generalized Markov number. All generalized Markov numbers appear in this way.

  • The triple \((\eta (G_{\gamma _1,T}),\eta (G_{\gamma _2,T}),\eta (G_{\gamma _3,T}))\) is a generalized Markov triple. All generalized Markov triples appear in this way.

Remark 1

The description of generalized snake graphs in [4] was only concerned with orbifolds without punctures. When punctures are present in a surface, in order to consider the corresponding cluster algebra one must use tagged arcs and tagged triangulations. However, any triangulation of \(\mathcal {O}_3\) consists of three pending arcs, which must all have the same tagging at the unique puncture. Thus, if we consider an initial triangulation with all arcs tagged plain, we can use generalized snake graphs to compute the generalized cluster variables resulting from any finite sequence of mutations.

2.4 Continued fractions

Çanakçı and Schiffler give a method to compute the number of perfect matchings of a snake graph via continued fractions in [9]. This method first requires knowledge of a sign function on a snake graph.

Definition 3

Given a snake graph G, a sign function on G labels all edges of the snake graph with \(+\) or − such that

  1. 1.

    the signs on the South and East edges of a tile are the same,

  2. 2.

    the signs on the North and West edges of a tile are the same,

  3. 3.

    the signs on the North and South edges of a tile are the opposite, and

  4. 4.

    the signs on the East and West edges of a tile are the opposite.

In order to have a unique sign function on each snake graph, we instill the convention that the South edge of the first tile is assigned the sign −.

The sign sequence of a snake graph G with \(m-1\) tiles is \(f_1,\ldots ,f_m\) where \(f_1\) is the sign on the south edge of the first tile (− by convention), for \(1< i < m\), \(f_i\) is the sign of the edge shared by tiles \(G_i\) and \(G_{i+1}\), and \(f_m = f_{m-1}\).

We call the edge shared by tiles \(G_i\) and \(G_{i+1}\) an internal edge.

A consequence of the definition of a sign function is that the sign is constant on a diagonal line through the edges of the snake graph traveling North-East. Moreover, we can see that a snake graph is determined by its sign sequence.

From the sign sequence, we can compute the number of perfect matchings of a snake graph by looking at the numerator of an associated continued fraction.

Definition 4

Let \(a_1,\ldots ,a_n\) be a sequence of integers. Then, the continued fraction, \([a_1,\ldots ,a_n]\) is given by

$$\begin{aligned}{}[a_1,\ldots ,a_n] = a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \frac{1}{\ddots + \frac{1}{a_n}}}} \end{aligned}$$

Every rational number can be expressed as a continued fraction. This expression is unique if we require \(a_n > 1\); it is straightforward to see that if \(a_n > 1\), \([a_1,\ldots ,a_n] = [a_1,\ldots ,a_n - 1,1]\).

Given a snake graph with sign sequence \(f_1,\ldots ,f_m\), we form a continued fraction \([a_1,\ldots ,a_n]\) by counting the lengths of subsequences of the sign sequence which have the same sign. For example, if the sign sequence is \(--+++--\), then the continued fraction will be [2, 3, 2]. Since \([a_1,\ldots ,a_n] = [a_1,\ldots ,a_n - 1,1]\), we can choose \(f_{m-1} = f_m\) in the sign sequence from a snake graph G on m tiles. Pictorially, we can choose the sign of either the North or East edge of the last tile, so we always choose the one which has the same sign as the internal edge of the last tile.

Let \(\mathcal {N}([a_1,\ldots ,a_n])\) be the numerator of the continued fraction \([a_1,\ldots ,a_n]\). Let \(\mathcal {G}[a_1,\ldots ,a_n]\) be the snake graph whose sign function gives the continued fraction \([a_1,\ldots ,a_n]\); after fixing our conventions, this snake graph is unique.

Theorem 4

([9], Theorem A) Let \(a_1,\ldots ,a_n\) be a sequence of positive integers such that \(a_n > 1\). Then,

$$\begin{aligned}{}[a_1,\ldots ,a_n] = \frac{\eta (\mathcal {G}[a_1,\ldots ,a_n])}{\eta (\mathcal {G}[a_2,\ldots ,a_n])}, \end{aligned}$$

where the right-hand side is reduced. In particular, \(\eta (\mathcal {G}[a_1,\ldots ,a_n]) = \mathcal {N}[a_1,\ldots ,a_n]\).

Example 1

We display the entire sign function on the following 5-tile snake graph. The sign sequence from this snake graph is \(-,-,-,+,+,+\).

figure f

The continued fraction to compute in this case is [3, 3]. We have that \([3,3] = 3 + \frac{1}{3} = \frac{10}{3}\), and indeed this snake graph has 10 perfect matchings.

We record a few results concerning continued fractions which will be useful for our later calculations. The first two are well-known.

Lemma 2

Let \(a_1,\ldots ,a_n\) be positive integers. Then,

$$\begin{aligned} \mathcal {N}[a_1,\ldots ,a_n] = \mathcal {N}[a_n,\ldots ,a_1]. \end{aligned}$$

Lemma 3

Let \(n \ge 2\) and let \(a_1,\ldots ,a_n\) be positive integers. Then,

$$\begin{aligned} \mathcal {N}[a_1,\ldots ,a_n] = a_1 \mathcal {N}[a_2,\ldots ,a_n] + \mathcal {N}[a_3,\ldots ,a_n] \end{aligned}$$

and

$$\begin{aligned} \mathcal {N}[a_1,\ldots ,a_n] = a_n \mathcal {N}[a_1,\ldots ,a_{n-1}] + \mathcal {N}[a_1,\ldots ,a_{n-2}]. \end{aligned}$$

where we define \(\mathcal {N}[] = 1\).

It is clear that \([a_1,\ldots ,a_n,1] = [a_1,\ldots ,a_n+1]\). Combining this with Lemma 2 gives us a result for continued fractions with 1 as the first entry.

Lemma 4

Let \(a_1,\ldots ,a_n\) be positive integers. Then,

$$\begin{aligned} \mathcal {N}[1,a_1,\ldots ,a_n] = \mathcal {N}[a_1+1,\ldots ,a_n]. \end{aligned}$$

The final result in this section will be useful in the proof of Theorem 8.

Lemma 5

Let \(k \ge 2\) and let \(a_1,\ldots ,a_k\) be positive integers. Then,

$$\begin{aligned} \mathcal {N}[a_2,\ldots ,a_k+1, a_k , \ldots , a_1] = \mathcal {N}[a_1,\ldots ,a_k+1,a_k,\ldots ,a_2] + (-1)^k \end{aligned}$$

Proof

We prove this by induction. For the base case, we directly compute

$$\begin{aligned} \mathcal {N}[a_1, a_2, a_2+1] = a_1(a_2^2 + a_2+1)+a_2 + 1 \end{aligned}$$

and

$$\begin{aligned} \mathcal {N}[a_1,a_2+1,a_2] = a_1(a_2^2 + a_2+1)+a_2. \end{aligned}$$

Now, we assume the claim for \(k-1\) and analyze the case for k. We expand the first term using Lemma 3 ,

$$\begin{aligned}&\mathcal {N}[a_2,\ldots ,a_k+1, a_k, \ldots , a_1] \\&\quad = a_1 \mathcal {N}[a_2,\ldots ,a_k+1, a_k, \ldots , a_2] + \mathcal {N}[a_2, \ldots ,a_k+1, a_k, \ldots , a_3]\\&\quad =a_1 \mathcal {N}[a_2,\ldots ,a_k+1, a_k, \ldots , a_2] + \mathcal {N}[a_3, \ldots ,a_k+1, a_k , \ldots , a_2] - (-1)^{k-1}, \end{aligned}$$

where the last equality comes from applying the inductive hypothesis.

Then we also apply Lemma 3 to the continued fraction on the righthand side,

$$\begin{aligned}&\mathcal {N}[a_1, a_2,\ldots ,a_k+1, a_k, \ldots , a_2] \\&\quad = a_1 \mathcal {N}[a_2,\ldots ,a_k, a_k + 1, \ldots , a_2] + \mathcal {N}[a_3, \ldots ,a_k+1, a_k, \ldots , a_2].\\ \end{aligned}$$

Thus, we see that \(\mathcal {N}[a_2,\ldots ,a_k+1,a_k,\ldots ,a_1] = \mathcal {N}[a_1,\ldots ,a_k+1,a_k,\ldots ,a_2] - (-1)^{k-1}\). Therefore, \((-1)^k = -(-1)^{k-1}\); since the base case showed the sign is 1 in the \(k = 2\) case, we are done. \(\square \)

3 Algorithm

Recall from Sect. 2.1 that we index generalized Markov numbers with (reduced) rational numbers \(\frac{p}{q}\) in the interval (0, 1]. However, given such a rational number \(\frac{p}{q}\), it is not immediately clear what the generalized Markov number \(m_{\frac{p}{q}}\) is. In this section, we give a direct way to compute \(m_{\frac{p}{q}}\). By Corollary 1, there is an arc \(\overline{\gamma }_{\frac{p}{q}}\) such that \(m_{\frac{p}{q}} = \eta (G_{\overline{\gamma }_{\frac{p}{q}},T})\). Our algorithm is inspired by the shape of the snake graph \(G_{\overline{\gamma }_{\frac{p}{q}},T}\). However, it is more compact to give the continued fraction \([a_1,\ldots ,a_n]\) associated to this snake graph. It will also turn out that we can get all necessary information from the universal cover of the torus and in particular can simply consider \(\gamma _{\frac{p}{q}}\), the line segment from (0, 0) to (qp). We remark that, for the ordinary Markov case, Çanakçı and Schiffler give a similar construction in [9].

In what follows, we will describe a function \(\textbf{f}\) which maps from \(\mathbb {Q} \cap (0,1]\) to sequences from the alphabet \(\{-,+\}\) of varied length. In particular, \(\textbf{f}(\frac{p}{q}) = (f_0,\ldots ,f_{4(p+q)-6})\) where \(f_i \in \{-,+\}\). In Theorem 5, we show \(\textbf{f}(\frac{p}{q})\) is the sign sequence of \(G_{\overline{\gamma }_{\frac{p}{q}},T}\).

Throughout, we fix the lattice given by all lines through integral points with slopes 0, 1,  and \(\infty \). We will consider each line segment between consecutive pairs of integer points as a distinct arcs.

For convenience, we will orient \(\gamma _{\frac{p}{q}}\) from (0, 0) to (qp). We can describe \(\textbf{f}(\frac{p}{q}) = (f_0,\ldots ,f_{4(p+q)-6})\) as the following. We always set \(f_0 = -\) and \(f_{4(p+q)-6} = +\). For \(1 \le i \le 2(p+q)-3\), let \(\sigma _i\) be the i-th line segment in the lattice which \(\gamma _{\frac{p}{q}}\) crosses, and let \(s_i\) be this intersection point. The odd-indexed entries keep track of whether \(s_i\) is closer to endpoint of \(\sigma _i\) which lies to the right or to the left of \(\gamma _{\frac{p}{q}}\); if it is closer to the endpoint on the right, we assign \(f_{2i+1} = -\) and otherwise we assign \(f_{2i+1} = +\). There is only one intersection point which is at the midpoint of an arc, and we will see we can choose either sign here. The even-indexed entries record whether the endpoint shared by \(\sigma _i\) and \(\sigma _{i+1}\) lies to the right or left of \(\gamma _{\frac{p}{q}}\). Again, if this endpoint is to the right, then assign \(f_{2i} = -\), and assign \(f_{2i} = +\) if it lies to the left.

In the following, we give formulas to directly compute \(\textbf{f}(\frac{p}{q})\). First, we recall notation given in [9].

$$\begin{aligned}&v_1 = \lfloor \frac{q}{p} \rfloor \\&v_i = \lfloor \frac{qi}{p} \rfloor - (v_1 + \cdots + v_{i-1}) \quad 1< i < p\\&v_p = (q-1) - (v_1 + \cdots + v_{p-1}) \end{aligned}$$

The quantity \(v_i\) tell us how many vertical lines \(\gamma _{\frac{p}{q}}\) crosses between its crossing of the horizontal lines \(y = i-1\) and \(y = i\). For \(0< i < p\), we define

$$\begin{aligned} \widetilde{v_i} = \lfloor \frac{qi}{p} \rfloor + i \end{aligned}$$

The \(\widetilde{v_i}\) give information about which arcs \(\sigma _j\) are horizontal. In particular \(\sigma _j\) is horizontal if and only if \(j = 2\widetilde{v_i}\). It will later be convenient to set \(\widetilde{v_0} = 0\) and \(\widetilde{v_p} = p+q-1\).

As in [9], we can compute the even-indexed terms \(f_{2i}\) using the \(v_i\) and \(\widetilde{v_i}\). First we specify \(f_{2i}\) if there exists \(0< j< p\) such that \(2\widetilde{v_j} - 2 \le i \le 2\widetilde{v_j} + 1\),. This corresponds to the crossings near a crossing of \(\gamma _{\frac{p}{q}}\) and a horizontal line segment; in particular, since the slope is less than 1, we know that the arcs crossed by \(\gamma _{\frac{p}{q}}\) near a crossing with a horizontal arc will have the pattern: vertical, diagonal, horizontal, diagonal, vertical. Thus, we set

$$\begin{aligned} f_{2(2\widetilde{v_j} - 2)} = f_{2(2\widetilde{v_j} - 1)} = +\\ f_{4\widetilde{v_j}} = f_{2(2\widetilde{v_j}+1)} = -\\ \end{aligned}$$
figure g

The rest of the even-indexed entries correspond to \(\gamma _{\frac{p}{q}}\) crossing an alternating sequence of vertical and diagonal edges. Precisely, if for some \(0 \le j < p\), i satisfies \(2\widetilde{v_j} + 1< i < 2\widetilde{v_{j+1}} - 2\), then

$$\begin{aligned} f_{2i} = {\left\{ \begin{array}{ll} - &{} i \text { is even} \\ + &{} \text {otherwise.} \end{array}\right. } \end{aligned}$$
figure h

Finally, we also set \(f_0 = f_2 = -\) and \(f_{4(p+q)-6} = +\).

Next we turn to the odd-indexed entries. The entries \(f_j\) for \(j \equiv 3 \pmod {4}\) of \(\textbf{f}(\frac{p}{q})\) record information about the crossing points of \(\gamma _{\frac{p}{q}}\) and horizontal and vertical line segments. We know that the segment \(\sigma _{2\widetilde{v_j}}\) lies on the line \(y = j\). Thus, we compute whether the intersection of \(\gamma _{\frac{p}{q}}\) and \(\sigma _{2\widetilde{v_j}}\) is closer to the right or left endpoint with the following,

$$\begin{aligned} f_{4(\widetilde{v_j} - 1) + 3} = {\left\{ \begin{array}{ll} - &{}\lceil \frac{jq}{p} \rceil - \frac{jq}{p} < \frac{1}{2} \\ + &{} \text { otherwise.} \\ \end{array}\right. } \end{aligned}$$

All other entries \(f_i\) with \(i \equiv 3 \pmod {4}\) record information about the crossing of \(\gamma _{\frac{p}{q}}\) and a vertical edge. If \(i \ne \widetilde{v_j}\) for any \(1 \le j \le p-1\), let \(i'\) be the largest integer in \([0,p-1]\) such that \(i > \widetilde{v_{i'}} \). This implies that arc \(\sigma _{2j}\) lies on the line \(x = i - i'\). Therefore, we set

$$\begin{aligned} f_{4(i - 1) + 3} = {\left\{ \begin{array}{ll} - &{} \ \frac{(i-i')p}{q} - \lfloor \frac{(i-i')p}{q}\rfloor < \frac{1}{2} \\ + &{} \text { otherwise.} \\ \end{array}\right. } \end{aligned}$$

Finally, we look at the intersections of \(\gamma _{\frac{p}{q}}\) and diagonal arcs. Note that all arcs \(\sigma _j\) for odd j are diagonal. We define \(w_i\) for \(1 \le i \le p+q-1\),

$$\begin{aligned} w_i = \frac{qi}{p+q}. \end{aligned}$$

Since \(\gamma _{\frac{p}{q}}\) and \(y = -x + i\) intersect at \((w_i, \frac{p}{q} w_i)\), we set

$$\begin{aligned} f_{4(i-1)+1} = {\left\{ \begin{array}{ll} - &{} \lceil w_i \rceil - w_i < \frac{1}{2} \\ + &{} \text { otherwise.}\\ \end{array}\right. } \end{aligned}$$

In Table 2, we give the continued fractions for the sign sequences \(\textbf{f}(\frac{p}{q})\) and we give the numerators of these continued fractions in Table 1. The values associated to (pq) with \(\gcd (p,q) > 1\) in both tables will be explained in Section 5.

Table 1 Numbers \(m_{(q,p)}\) for small values of \(p \le q \le 7\). When \(\gcd (p,q) = 1\), these are generalized Markov numbers \(m_{\frac{p}{q}}\). For discussion of the other values, see Sect. 5
Table 2 Continued fractions given from sign sequences \(\textbf{f}(q,p)\). In each case, \(m_{(q,p)}\) is the numerator of this continued fraction

For any \(\frac{p}{q}\), the sequence \(\textbf{f}(\frac{p}{q}) = (f_0,f_1,\ldots ,f_{4(p+q) - 6})\) is anti-symmetric. That is, for \(i < 2(p+q) - 3\), \(f_{i} = - f_{(4(p+q)-6)-i}\). Moreover, the middle term of the sequence \(\textbf{f}(\frac{p}{q})\), \(f_{2(p+q) - 3}\), always corresponds to a crossing which is the midpoint of the segment of \(\sigma _{p+q-1}\); no other crossing can occur at a midpoint, or else \(\gamma _{\frac{p}{q}}\) would go through other integral points besides (0, 0) and (qp). By Lemma 2, since the rest of the sequence is anti-symmetric, the choice of sign at the midpoint does not matter.

In Theorem 5, we show that \(\textbf{f}(\frac{p}{q})\) exactly gives the sign sequence for the snake graph \(G_{\gamma ,T}\) which encodes the generalized Markov number \(m_{\frac{p}{q}}\). Recall such an arc \(\gamma \) and snake graph \(G_{\gamma ,T}\) is guaranteed in Corollary 1.

Theorem 5

Let \(p,q \in \mathbb {Z}\) be such that \(p < q\) and \(\gcd (p,q) = 1\). Let \(\textbf{f}(\frac{p}{q})\) be the sign function on \(\frac{p}{q}\), and let \([a_1,\ldots ,a_m]\) be the continued fraction from \(\textbf{f}(\frac{p}{q})\). Then, if \(m_{\frac{p}{q}}\) is the generalized Markov number associated to \(\frac{p}{q}\),

$$\begin{aligned} m_{\frac{p}{q}} = \mathcal {N}([a_1,\ldots ,a_m]) = \eta (G_{\overline{\gamma }_{\frac{p}{q}},T_0}), \end{aligned}$$

where \(\overline{\gamma }_{\frac{p}{q}}\) is the arc on \(\mathcal {O}_3\) associated to the generalized Markov number \(m_{\frac{p}{q}}\) and \(T_0\) is the initial triangulation of \(\mathcal {O}_3\).

Proof

We will induct on the number of flips to reach the arc with slope \(\frac{p}{q}\). Once we show that \(\textbf{f}(\frac{p}{q})\) is the same as the sign sequence of \(G_{\overline{\gamma }_{\frac{p}{q}},T_0}\), the statement of the theorem will follow from Theorem 4.

Since flipping arcs is an involution, we update how we go between rational numbers, as in Lemma 1, to also make it an involution. Let \((\frac{a}{b}, \frac{c}{d}, \frac{e}{f}) \in \mathbb {Q}^3\). We define the mutation of \(\frac{e}{f}\) as \(\mu _{\frac{e}{f}}(\frac{a}{b}, \frac{c}{d}, \frac{e}{f}) = (\frac{a}{b}, \frac{c}{d}, \frac{e'}{f'})\) where

$$\begin{aligned} \frac{e'}{f'} = {\left\{ \begin{array}{ll} \frac{a+c}{b+d} &{} \frac{e}{f} \ne \frac{a+c}{b+d}\\ \frac{c-a}{d-b} &{} \frac{e}{f} =\frac{a+c}{b+d}.\\ \end{array}\right. } \end{aligned}$$

In the following, we analyze arcs on the orbifold \(\mathcal {O}_3\), but we retain our labeling of arcs with rational numbers. That is, we label the arcs in \(T_0\) as \((\tau _{\frac{0}{1}},\tau _{\frac{1}{0}},\tau _{\frac{-1}{1}})\) and use the convention that in a sequence of flips, the first arc flipped is \(\tau _{\frac{-1}{1}}\) and, if the sequence is at least length two, the next flip is at \(\tau _{\frac{1}{0}}\). In general, the flip of \(\tau _{\frac{e}{f}}\) in a triangulation \((\tau _{\frac{a}{b}}, \tau _{\frac{c}{d}},\tau _{\frac{e}{f}})\) results in the triangulation \((\tau _{\frac{a}{b}}, \tau _{\frac{c}{d}},\tau _{\frac{e'}{f'}})\) where \(\frac{e'}{f'} = \mu _{\frac{e}{f}}(\frac{a}{b}, \frac{c}{d}, \frac{e}{f})\).

For our base cases, one can check the claim for slopes \(\frac{1}{1}\) and \(\frac{1}{2}\) directly. Note these correspond to one and two (distinct) flips from \(T_0\) respectively.

Let \(\mathbf {\alpha } = \alpha _1,\ldots ,\alpha _\ell \) be a sequence of rational numbers such that \(\alpha _1 = \frac{-1}{1}, \alpha _2 = \frac{1}{0}\), and for all \(2 < i \le \ell \), \(\alpha _i \in \mu _{\alpha _{i-1}} \circ \cdots \circ \mu _{\alpha _1}(\frac{0}{1}, \frac{1}{0},\frac{-1}{1})\). We let \(\mu _{\mathbf {\alpha }}\) denote the composition \(\mu _{\alpha _\ell } \circ \cdots \circ \mu _{\alpha _1}\). By Lemma 1, as long as our mutation sequence has length at least one, we know that the tuple \(\mu _{\mathbf {\alpha }}(\frac{0}{1}, \frac{1}{0},\frac{-1}{1})\) is of the form \((\frac{a}{b},\frac{c}{d},\frac{a+c}{b+d})\) where \(c \ge a\) and \(d \ge b\). Since these are distinct numbers, at least one inequality is strict.

We show that knowing \(\textbf{f}(\frac{c}{d})\) and the sign sequence of \(G_{\overline{\tau _{\frac{c}{d}}}, T_0}\) are equal will also tell us that \(\textbf{f}(\frac{a+c}{b+d})\) and the sign sequence of \(G_{\overline{\tau _{\frac{a+c}{b+d}}}, T_0}\) are equal. In the following, we drop the overlines for arcs in \(\mathcal {O}_3\). First, consider a triangulation of \(\mathcal {O}_3\), \((\tau _{\frac{a}{b}}, \tau _{\frac{c}{d}}, \tau _{\frac{a+c}{b+d}})\). Since these three arcs are compatible, we can see that there is an initial section of \(\tau _{\frac{a+c}{b+d}}\) which is homotopic to \(\tau _{\frac{c}{d}}\). Suppose that \(\tau _{\frac{c}{d}}\) crosses all three arcs from \(T_0\) at least once. Then, the section of \(\tau _{\frac{a+c}{b+d}}\) which is homotopic to \(\tau _{\frac{c}{d}}\) is over halfway along the arc; note that since pending arcs are loops, they all have a “halfway” point where they curve around the orbifold point that they enclose. Thus, we know that the first \(4(c+d) - 5\) entries of the sign sequence for \(G_{\tau _{\frac{a+c}{b+d}},T_0}\) and \(G_{\tau _{\frac{c}{d}},T_0}\) are the same. By the symmetry of the snake graph for a pending arc (given by the fact that pending arcs are drawn as loops), this completely determines the sign sequence for \(G_{\tau _{\frac{a+c}{b+d}},T_0}\).

Since we already considered the base cases of slopes \(\frac{1}{1}\) and \(\frac{1}{2}\), we do not need to consider the case when \(\tau _{\frac{c}{d}}\) only crosses one arc from \(T_0\). So we next suppose that \(\tau _{\frac{c}{d}}\) only crosses two of the arcs from \(T_0\). If \(\tau _{\frac{a+c}{b+d}}\) also only crosses two arcs from \(T_0\), then we have the same situation as above. Note in this case that \(\frac{a}{b} = \frac{0}{1}\) since we are assuming we only flipped two of the arcs in the initial triangulation, which by convention are \(\tau _{\frac{-1}{1}}\) and \(\tau _{\frac{1}{0}}\) . Now suppose that \(\tau _{\frac{a+c}{b+d}}\) does cross all three arcs from \(T_0\); necessarily, \(\tau _{\frac{a+c}{b+d}}\) is the result of flipping \(\tau _{\frac{0}{1}}\) in the tuple \((\tau _{\frac{0}{1}}, \tau _{\frac{1}{n}}, \tau _{\frac{1}{n+1}})\); i.e., \(a=c=1, b = n \ge 1, d = n+1\). Then the segment of \(\tau _{\frac{a+c}{b+d}}\) which is homotopic to \(\tau _{\frac{c}{d}}\) is the portion until the first intersection of \(\tau _{\frac{a+c}{b+d}}\) and \(\tau _{\frac{0}{1}}\). Note that the halfway point of \(\tau _{\frac{a+c}{b+d}}\) occurs between its two intersections with \(\tau _{\frac{0}{1}}\). In order to have our conventions agree, suppose that \(\tau _{\frac{1}{0}}\) follows \(\tau _{\frac{-1}{1}}\) in clockwise order, so that \(\tau _{\frac{-1}{1}}\) follows \(\tau _{\frac{0}{1}}\) in clockwise order. Then, the first part of the sign sequence for \(G_{\tau _{\frac{a+c}{b+d}},T_0}\) consists of the sign sequence for \(G_{\tau _{\frac{c}{d}},T_0}\) followed by \(+\) since the last arc which \(\tau _{\frac{c}{d}}\) crosses is \(\tau _{\frac{-1}{1}}\), and the next arc \(\tau _{\frac{a+c}{b+d}}\) crosses, after the section which is homotopic to \(\tau _{\frac{c}{d}}\), is \(\tau _{\frac{0}{1}}\). The next sign is the middle sign of the sign sequence for \(G_{\tau _{\frac{a+c}{b+d}},T_0}\) which depends on the orientation of \(\tau _{\frac{a+c}{b+d}}\). All other signs are determined by the symmetry of sign sequences for snake graphs from pending arcs.

Now we consider how the sequences \(\textbf{f}(\frac{c}{d})\) and \(\textbf{f}(\frac{a+c}{b+d})\) compare and show it is identical to the case for the snake graphs from the arcs with these labels. For \(a \le c, b \le d\), we have \(\lfloor \frac{4(a+b+c+d) - 5}{2}\rfloor = 2(a+b+c+d) - 2 < 2(2c + 2d - 1) -2 = 4(c+d) - 4\). By induction we can show that the triangle with vertices \((0,0), (d+b,a+c),(d,c)\) has no interior vertices in \(\mathbb {Z}^2\); from this, we know the first \(4(c+d) - 5\) entries of \(\textbf{f}(\frac{a+c}{b+d})\) are the same as the entries of \(\textbf{f}(\frac{c}{d})\). When \(c>a\) and \(d>b\), this covers over half the sequence \(\textbf{f}(\frac{a+c}{b+d})\); by the anti-symmetry of the sign sequences, this completely determines \(\textbf{f}(\frac{a+c}{b+d})\). Since we knew that \(\textbf{f}(\frac{c}{d})\) matched the sign sequence for \(G_{\tau _{\frac{c}{d}},T_0}\), we know the same for \(\textbf{f}(\frac{a+c}{b+d})\) and \(G_{\tau _{\frac{a+c}{b+d}},T_0}\)

The case when we do not have both \(c>a\) and \(d>b\) is again when \(\frac{a}{b} = \frac{1}{n}\) and \(\frac{c}{d} = \frac{1}{n+1}\). In this case, if \(\textbf{f}(\frac{a+c}{b+d}) = \textbf{f}(\frac{2}{2n+1})= (f_0,\ldots ,f_{4(3+2n)-6})\), the first \(4(n+2)-6 = 4n+2\) entries are the same as \(f(\frac{1}{n+1})\). We know that \(f_{4n+2} = +\) since this corresponds to the shared vertex between a diagonal and horizontal line segment, when traveling from the diagonal crossing to the horizontal. Then, \(f_{4n+3}\) can be either \(+\) or −, as this crossing occurs at the midpoint of \(\sigma _{p+q-1}\). The rest of the entries follow from the anti-symmetry. We can again see that, since the sign sequence for \(G_{\tau _{\frac{c}{d}},T_0}\) agrees with \(\textbf{f}(\frac{c}{d})\), the sequence for \(G_{\tau _{\frac{a+c}{b+d}},T_0}\) will agree with \(\textbf{f}(\frac{a+c}{b+d})\), as long as we choose the same sign at the middle term. (Moreover, this middle term will not affect the number of perfect matchings of \(G_{\tau _{\frac{a+c}{b+d}},T_0}\) since it does not affect the numerator of the corresponding continued fraction by Lemma 2.) \(\square \)

We note that a version of Theorem 5 is already known for ordinary Markov numbers. Given \(p<q\) with \(\gcd (p,q) = 1\), let \(\textbf{e}(\frac{p}{q})\) be the sequence of length \(2(p+q)-2\) which consists only of the even-indexed entries from \(\textbf{f}(\frac{p}{q})\); that is, \(\textbf{e}(\frac{p}{q}) = (f_0,f_2,\ldots , f_{4(p+q)-6})\). This sequence was described in [9], but the result was originally known by Frobenius.

Theorem 6

([9, 15]) Let \(p,q \in \mathbb {Z}\) be such that \(p < q\) and \(\gcd (p,q) = 1\). Let \(\textbf{e}(\frac{p}{q})\) be the even-indexed sign function on \(\frac{p}{q}\), and let \([b_1,\ldots ,b_m]\) be the continued fraction from \(\textbf{e}(\frac{p}{q})\). Then, if \(n_{\frac{p}{q}}\) is the ordinary Markov number associated to \(\frac{p}{q}\),

$$\begin{aligned} n_{\frac{p}{q}} = \mathcal {N}([b_1,\ldots ,b_m]). \end{aligned}$$

We have thus far considered arcs \(\gamma _{\frac{p}{q}}\) with \(p\le q\) so that each generalized Markov number corresponds to a unique arc. However, we could equivalently consider arcs between the origin and (pq); this would correspond to flip sequences which begin with flipping first \(\tau _{\frac{-1}{1}}\) and then \(\tau _{\frac{0}{1}}\). By our description of the meaning \(\textbf{f}\) at the beginning of the section, we can extend the domain of \(\textbf{f}\) to include all \(\mathbb {Q}_{>0}\). To line up the conventions, we say that, if \(p<q\), then \(f_0 = +\) and \(f_{4(p+q)-6} = -\) in \(\textbf{f}(\frac{q}{p})\).

Proposition 1

Let \(p < q\) and \(\gcd (p,q) = 1\). Suppose \(\textbf{f}(\frac{p}{q}) = (f_0,\ldots ,f_{4(p+q)-6})\) and \(\textbf{f}(\frac{q}{p}) = (f_0',\ldots ,f_{4(p+q)-6}')\). Then for all \(0 \le i \le 4(p+q)-6\), besides possibly \(i = 2(p+q)-3\), \(f_i = -\) if and only if \(f_i' = +\).

Proof

One can check that at each stage of the algorithm, the signs will be reversed for slopes \(\frac{p}{q}\) and \(\frac{q}{p}\). We can again choose either sign for \(f_{2(p+q)-3}\) and \(f'_{2(p+q)-3}\). \(\square \)

4 Patterns

In this section, we explore patterns amongst the generalized Markov numbers \(m_{\frac{p}{q}}\) and the continued fraction expansions given in Sect. 3. Given integers \(p<q\) with \(\gcd (p,q) = 1\), let \(C_{\frac{p}{q}} = a_1,\ldots ,a_m\) be the sequence of positive integers such that \(m_{\frac{p}{q}} = \mathcal {N}([C_{\frac{p}{q}}])\), subject to our conventions. Similarly, let \(C^{\text {ord}}_{\frac{p}{q}} = b_1,\ldots ,b_{m'}\) be the sequence of positive integers such that \(n_{\frac{p}{q}} = \mathcal {N}[C^{\text {ord}}_{\frac{p}{q}}]\), with the same conventions. We begin this section by describing some properties of the sequence \(C_{\frac{p}{q}}\) and how it compares to \(C^{\text {ord}}_{\frac{p}{q}}\). Then, we analyze the behavior of two special families of generalized Markov numbers, \(m_{\frac{1}{q}}\) and \(m_{\frac{q-1}{q}}\), and compare these with the corresponding families in the ordinary Markov case.

4.1 Properties of \(C_{\frac{p}{q}}\)

In this subsection, we explain more concretely how the continued fractions associated to generalized and ordinary Markov numbers compare. This allows us to give an elementary description of the continued fractions produced by the algorithm given in Sect. 3.

Lemma 6

Let \(p < q\) be such that \(\gcd (p,q) = 1\). Let \(C_{\frac{p}{q}} = a_1,\ldots ,a_{m_1}\), and \(C^{\text {ord}}_{\frac{p}{q}} = b_1,\ldots ,b_{m_2}\) . Then, \(m_1 = m_2\) and

  1. 1.

    if \(b_i = 1, a_i \in \{1,2,3\}\), and

  2. 2.

    if \(b_i = 2, a_i \in \{3,4,5\}\).

Proof

The fact \(m_1 = m_2\) is implied by the observation that there will not be any more sign changes amongst the full sequence \(f_0,f_1\ldots f_{4(p+q) - 7} ,f_{4(p+q)-6}\) than if we just consider the even-indexed terms \(f_0,f_2,\ldots f_{4(p+q)-8},f_{4(p+q)-6}\). Consider two consecutive even-indexed terms which are equal, \(f_{2i}=f_{2i+2}\); this occurs if \(\gamma _{\frac{p}{q}}\) is crossing three arcs, say \(\sigma _i, \sigma _{i+1},\sigma _{i+2}\) which share an endpoint. Then, this shared endpoint is also the endpoint of \(\sigma _{i+1}\) which is closer to \(\gamma _{\frac{p}{q}}\), guaranteeing that \(f_{2i} = f_{2i+1} = f_{2i+2}\).

The other statements follow quickly. If \(f_{2i-2} \ne f_{2i}\) and \(f_{2i} \ne f_{2i+2}\), the largest subsequence of the same sign which includes \(f_{2i}\) has length 3. Similarly, if \(f_{2i-2} = f_{2i}\), which necessarily means \(f_{2i-4} \ne f_{2i-2}\) and \(f_{2i} \ne f_{2i+2}\), the largest subsequence of the same sign which includes \(f_{2i}\) has length 5. \(\square \)

We can combine this lemma with the following result given by Frobenius, and reproven in [9] using snake graphs, to give a similar description in our generalized case.

Theorem 7

[15] Let \(p < q\) be such that \(\gcd (p,q) = 1\). Let \(C^{\text {ord}}_{\frac{p}{q}} = b_1,\ldots ,b_m\). Then, \(b_i \in \{1,2\}\) for all i, m is necessarily even, and \(b_i = b_{m-i+1}\).

  1. 1.

    If \(p+1 = q\), then each \(b_i = 2\) and \(m = 2p\).

  2. 2.

    If \(p+1 < q\), there exists a unique positive integer c satisfying \(\frac{c-1}{c}< \frac{p}{q} < \frac{c}{c+1}\), and

    1. (a)

      there are at most \(p+1\) subsequences of 2s; the first and last are of length \(2c-1\) and all others are of length 2c or \(2c+2\);

    2. (b)

      there are at most p subsequences of 1s, with the i-th subsequence having length \(2\mu _i\), where the \(\mu _i\) satisfy \(\vert \mu _i - \mu _j \vert \le 1\) for all ij.

Corollary 2

Let \(p < q\) be such that \(\gcd (p,q) = 1\). Let \(C_{\frac{p}{q}} = a_1,\ldots ,a_m\) with \(a_1,a_m > 1\). Then,

  1. 1.

    \(1 \le a_i \le 5\);

  2. 2.

    \(m = 2(q-1)\);

  3. 3.

    if \(i < q-1\), \(a_i = a_{2(q-1) - i + 1}\), and \(\vert a_{q-1} - a_{q} \vert = 1\);

  4. 4.

    if \(p+1 = q\), each \(a_i \in \{3,4,5\}\);

  5. 5.

    if \(p+1 < q\), let c be as in Theorem 7.

    1. (a)

      There are at most \(p+1\) subsequences of numbers in \(\{3,4,5\}\) which are not all 3; the first and last have length \(2c-1\) and all others are of length 2c or \(2c+2\).

    2. (b)

      There are at most p subsequences of numbers in \(\{1,2,3\}\) which are not all 3, with the i-th subsequence having length \(2\mu _i\) where the \(\mu _i\) satisfy \(\vert \mu _i - \mu _j \vert \le 1\) for all ij.

Proof

Most parts of the result follow from combining Lemma 6 and Theorem 7. The fact that \(m = 2(q-1)\) follows from Lemma 6 and the description of the continued fractions given in [9]. Part 3 follows from the antisymmetry of the terms. The fact that the subsequences in part 5 each contain numbers other than 3 follows from noticing that there is no configuration which would produce a consecutive pair of entries 3. \(\square \)

Part 3 of Corollary 2 shows that the middle terms in \(C_{\frac{p}{q}}\) will always differ by one. Here, we show any such pair of adjacent integers, with both being between one and five, is attainable by analyzing the middle terms.

Lemma 7

Let \(p,q \in \mathbb {Z}_{>0}\) be such that \(p<q\) and \(\gcd (p,q) = 1\). Let \(G_{\frac{p}{q}} = \mathcal {G}[a_1,\ldots ,a_{2(q-1)}]\).

  1. 1.

    If p and q are odd, then \(\{a_{q-1},a_q\} = \{1,2\}\).

  2. 2.

    If p is even and q is odd, then, \(\{a_{q-1},a_q\} = \{4,5\}\).

  3. 3.

    If p is odd, q is even, and \(p < 2q\), then \(\{a_{q-1},a_q\} = \{2,3\}\).

  4. 4.

    If p is odd, q is even, and \(p > 2q\), then, \(\{a_{q-1},a_q\} = \{3,4\}\).

Proof

For each part, the statement follows from analyzing the local configuration of the arcs around the central crossing of \(\gamma _{\frac{p}{q}}\). If p and q are both odd, so that the central crossing is a diagonal line segment which lies on \(y = -x + \frac{p+q}{2}\) and if \(\star \) denotes the central crossing, then we see the sign sequence near \(\star \) is \(-+\star -+\) where, as usual, − represents shared endpoints or crossing points to the right and \(+\) to the left.

figure i

If p is even and q is odd, so that the central arc crossed is horizontal, then the local configuration is as below, and the sign sequence near \(\star \) must be \(+---- \star ++++-\).

figure j

If p is odd and q is even, then there are two cases for the type of local configuration around the central arc crossed. First, suppose \(\frac{p}{q} < \frac{1}{2}\). Then, the local configuration includes only vertical and diagonal arcs. Here, the sign sequence near \(\star \) is \(-++\star --+\).

figure k

If \(\frac{p}{q} > \frac{1}{2}\), then there are horizontal arcs near the central arc crossed, and the sign sequence near \(\star \) is \(-+++\star ++++-\).

figure l

\(\square \)

4.2 Generalized Markov numbers for \(\frac{1}{q}\)

For ordinary Markov numbers, the sequence \(\{n_{\frac{1}{q}}\}_q\) is every other Fibonacci number: \(n_{\frac{1}{1}} = 2, n_{\frac{1}{2}} = 5, n_{\frac{1}{3}} = 13,\) and so on. Here we study \(\{m_{\frac{1}{q}}\}_q\). We begin by giving a linear recurrence which the sequence \(\{m_{\frac{1}{q}}\}_q\) satisfies.

Proposition 2

Set \(m_{\frac{1}{0}} = 1\) and \(m_{\frac{1}{1}} = 3\). Then, for all \(q \ge 2\),

$$\begin{aligned} m_{\frac{1}{q}} = 5 m_{\frac{1}{q-1}} - m_{\frac{1}{q-2}} - 1 \end{aligned}$$

Proof

In the Farey tree in Figure 1, we see that we reach a tuple with \(\frac{1}{q}\) by replacing \(\frac{1}{q-2}\) in the tuple \((\frac{0}{1}, \frac{1}{q-2}, \frac{1}{q-1})\). Therefore,

$$\begin{aligned} m_{\frac{1}{q}} = \frac{m_{\frac{1}{q-1}}^2 + m_{\frac{1}{q-1}}m_{\frac{0}{1}} + m_{\frac{0}{1}}^2}{m_{\frac{1}{q-2}}}. \end{aligned}$$

Since \((m_{\frac{0}{1}}, m_{\frac{1}{q-2}}, m_{\frac{1}{q-1}})\) is a generalized Markov triple, we can use the generalized Markov equation to change the numerator,

$$\begin{aligned} m_{\frac{1}{q}}&= \frac{6m_{\frac{1}{q-1}} m_{\frac{1}{q-2}} m_{\frac{0}{1}} - m_{\frac{1}{q-1}} m_{\frac{1}{q-2}} - m_{\frac{1}{q-2}}^2 - m_{\frac{1}{q-2}} m_{\frac{0}{1}}}{m_{\frac{1}{q-2}}}\\&= 5m_{\frac{1}{q-1}} - m_{\frac{1}{q-2}} - 1 \end{aligned}$$

where we simply by canceling terms and using the fact that \(m_{\frac{0}{1}} = 1\).

\(\square \)

Note the sequence \(\{n_{\frac{1}{q}}\}_q\) has the recurrence \(n_{\frac{1}{q}} = 3 n_{\frac{1}{q-1}} - n_{\frac{1}{q-2}}\).

The recurrence in Proposition 2 can be used to describe the limiting behavior of a ratio of the generalized Markov numbers \(m_{\frac{1}{q}}\).

Proposition 3

$$\begin{aligned} \lim _{q \rightarrow \infty } \frac{m_{\frac{1}{q}}}{m_{\frac{1}{q-1}}} = \frac{5 + \sqrt{21}}{2} \end{aligned}$$

The corresponding limit for ordinary Markov numbers is well-known

$$\begin{aligned} \lim _{q \rightarrow \infty } \frac{n_{\frac{1}{q}}}{n_{\frac{1}{q-1}}} \rightarrow \frac{3 + \sqrt{5}}{2} = 1 + \varphi . \end{aligned}$$

Our next goal is to give a cluster-algebraic interpretation to the limit given in Proposition 3. It will be useful for us to have a direct formula for the continued fractions which compute these generalized Markov numbers. In the following, let \(\alpha = (1,3)\) and let \(\alpha ^{-1} = (3,1)\).

Lemma 8

Let \(q \ge 3\). If q is odd, then \(C_{\frac{1}{q}} = [4,\alpha ^{\frac{q-3}{2}},2,1,(\alpha ^{-1})^{\frac{q-3}{2}},4]\). If q is even, then \(C_{\frac{1}{q}} = [4,\alpha ^{\frac{q-4}{2}},1,2,3,1,(\alpha ^{-1})^{\frac{q-4}{2}},4]\).

Proof

When \(q>> 0\), we can see a pattern when we are far from the middle crossing point. To the left of the middle crossing point, then \(\gamma _{\frac{1}{q}}\) will cross each arc closer to its right endpoint. The shared endpoints alternate between right and left since \(\gamma _{\frac{1}{q}}\) only crosses diagonal and vertical line segments. The same is true to the right of the middle crossing point, except that \(\gamma _{\frac{1}{q}}\) now crosses all arcs closer to their right endpoint. The first and last entries are 4 because of our convention to add an extra − at the beginning and an extra \(+\) at the end of our sign sequence.

figure m
figure n

Next we check how the pattern deviates near the middle crossing. As discussed in Lemma 7, this will depend on the parity of q. If q is odd, we can see that after three entries −, \(\gamma _{\frac{1}{q}}\) enters the quadrilateral around the diagonal line segment which is the central arc crossed. Then, choosing \(+\) at the middle crossing point, we have entries \(++,-\).

figure o

If q is even, then the pattern is interrupted at the middle crossing point in a different way. After a single entry \(+\), \(\gamma _{\frac{1}{q}}\) enters the quadrilateral around the vertical line segment which is the central arc crossed; here, we have entries \(+++, --\).

figure p

\(\square \)

Next, we give one technical lemma regarding computation of nearly two-periodic continued fractions, which will be useful in the proof of our next main result.

Lemma 9

Let \(z_1,z_2,r\) be nonzero elements of a ring R. Then, if the continued fraction \([z_1,z_2,rz_1,r^{-1}z_2,r^2z_1,r^{-2}z_2,\ldots ]\) converges, it converges to

$$\begin{aligned} \frac{r(1+z_1z_2) - 1 \pm \sqrt{(1-r(1 + z_1z_2))^2 +4rz_1z_2}}{2rz_2}. \end{aligned}$$

for some choice of sign.

Proof

Let \(L = [z_1,z_2,rz_1,r^{-1}z_2,r^2z_1,r^{-2}z_2,\ldots ]\), assuming \(z_1,z_2,r\) are chosen such that the infinite continued fraction converges. The proof follows from the fact that \([ra_1,r^{-1}a_2,ra_3,\ldots ,r^{(-1)^{m-1}}a_{m}] = r[a_1,a_2,\ldots ,a_m]\); this is for example given as Lemma 2.3 in [8]. By taking the limit of this fact to an infinite continued fraction, we see that \([rz_1,r^{-1}z_2,r^2z_1,r^{-2}z_2,\ldots ] = rL\). Then, L satisfies the following,

$$\begin{aligned} L = z_1 + \frac{1}{z_2 + \frac{1}{rL}}, \end{aligned}$$

which, by simplifying, implies that L satisfies the following quadratic equation,

$$\begin{aligned} rz_2L^2 + (1-r(1+z_1z_2))L - z_1 = 0. \end{aligned}$$

The statement follows from solving this quadratic equation. \(\square \)

Now that we understand the continued fraction \(C_{\frac{1}{q}} = a_1,\ldots ,a_m\), we will describe a labeling scheme for the edges of the snake graph \(\mathcal {G}[a_1,\ldots ,a_m]\). With these edge labels, we will produce the snake graph \(G_{\frac{1}{q}}\) for the arc \(\overline{\gamma _{\frac{1}{q}}}\) on \(\mathcal {O}_3\) associated to \(m_{\frac{1}{q}}\). Then, we set \(x_{\frac{1}{q}}^{T_0} = \frac{1}{\text {cross}(\gamma _{\frac{1}{q}},T_0)} \sum _P x(P)\), using notation from Theorem 2. Note that \(\text {cross}(\gamma _{\frac{1}{q}},T_0) = x_{\frac{-1}{1}}^{2q} x_{\frac{1}{0}}^{2(q-1)}\), where we continue our labeling scheme for the three arcs in \(T_0\).

In [8], the authors give a way to compute the quantity \(\chi (G_{\gamma ,T}):= \frac{1}{\text {cross}(\gamma ,T)} \sum _P x(P)\) via continued fractions. Given the snake graph \(G_{\gamma ,T}\), the authors define a family of Laurent polynomials \(L_1,\ldots ,L_m\) such that \(x_\gamma = [L_1,\ldots ,L_m]\). These are given by considering certain subgraphs of \(G_{\gamma ,T}\) determined by the sign sequence. Let \(a_1,\ldots ,a_m\) be such that the shape of \(G_{\gamma ,T}\) is \(\mathcal {G}[a_1,\ldots ,a_m]\), and suppose \(G_{\gamma ,T}\) has d tiles. For \(1 \le i \le m-1\), let \(\ell _i = \sum _{j=1}^i a_j\); for convenience, set \(\ell _0 = 0\) and \(\ell _m = d+1\). Then for \(1 \le i \le m\), if \(a_i > 1\), set \(H_i = (G_{\ell _{i-1}+1},G_{\ell _{i-1}+2},\ldots ,G_{\ell _i-1})\) (this is the subgraph of \(G_{\gamma ,T}\) given by only considering these tiles), and if \(a_i = 1\), we set \(H_i\) as the edge shared by tiles \(G_{\ell _{i-1}}\) and \(G_{\ell _i}\). If \(a_0 = 1\), we set \(H_1\) as the edge where we have chosen the first sign of the sequence, and similarly for \(H_m\).

We also define a family of terms \(b_i\). For \(1 \le i \le m-1\), let \(b_i\) be the label of the tile \(G_{\ell _i}\). Set \(b_0\) as the label of the edge in \(\{S(G_1),W(G_1)\}\) which is not used in the sign sequence and choose \(b_m\) similarly. In summary, the variables \(b_i\) record the edges and tiles that we ignore when forming the subgraphs \(H_j\).

Then, the Laurent polynomials \(L_i\) are defined by \(L_1 = \frac{1}{b_1} \chi (H_1), L_2 = \frac{b_1}{b_0b_2} \chi (H_2)\), and for \(i \ge 3\),

$$\begin{aligned} L_i = {\left\{ \begin{array}{ll} \frac{b_0 b_2^2 b_4^2 \cdots b_{i-3}^2 b_{i-1}}{b_1^2b_3^2\cdots b_{i-2}^2b_i} \chi (H_i) &{} i \text { is odd}\\ &{} \\ \frac{b_1^2b_3^2\cdots b_{i-3}^2b_{i-1}}{b_0 b_2^2 b_4^2 \cdots b_{i-2}^2b_i} \chi (H_i) &{} i \text { is even}. \end{array}\right. } \end{aligned}$$

In Section 7 of [8], the authors compute a few limits of the form \(\chi (G_i)/\chi (G_{i-1})\) for snake graphs \(G_i\) growing increasingly larger. We can follow their reasoning to compute similar limits in our construction.

We introduce the snake graph \(G_{\frac{1}{q}}\) for \(q \ge 1\). In this section, for simplicity in figures and calculations we set \(x_{\frac{-1}{1}} = x_1, x_{\frac{1}{0}} = x_2,\) and \(x_{\frac{0}{1}} = x_3\). The snake graph \(G_{\frac{1}{q}}\) has \(4q-2\) tiles, and for \(q>>1\) the first section is as in Figure 3. Since we will only be concerned with limiting behavior of \(\chi (G_\frac{1}{q})\), we will not give a complete example of a snake graph \(G_{\frac{1}{q}}\).

Fig. 3
figure 3

First part of \(G_{\frac{1}{q}}\) for \(q>> 1\)

If \(G = \mathcal {G}[a_1,\ldots ,a_n]\), let \(\hat{G} = \mathcal {G}[a_2,\ldots ,a_n]\); this will of course depend on our choice of sign on the first tile of G. We let \(\hat{G}_{\frac{1}{q}}\) be \(G_{\frac{1}{q}}\) with the first (southwest-most) tile removed, thus breaking from convention and using the expression \(G_{\frac{1}{q}} = \mathcal {G}[1,3,\ldots ,3,1]\).

Proposition 4

Let \(\delta = x_1+ x_2 + x_3\).

  1. 1.

    The limit of the ratio of \(\chi (G_{\frac{1}{q}})\) and \(\chi (\hat{G}_{\frac{1}{q}})\) converges as q goes to infinity, and this limit is equal to

    $$\begin{aligned} \frac{x_1^2 + \delta x_3 - x_2^2 + \sqrt{(x_2^2 - x_1^2 -\delta x_3)^2 + 4x_2^2x_3\delta }}{2 \delta x_2}. \end{aligned}$$
  2. 2.

    The limit of the ratio of \(x_{\frac{1}{q}}\) and \(x_{\frac{1}{q-1}}\) converges as q goes to \( \infty \), and this limit is equal to

    $$\begin{aligned} \frac{\delta x_3 + x_1^2 + 2x_1x_2 - x_2^2 + \sqrt{(x_1^2 - x_2^2 - \delta x_3)^2 + 4 x_1^2x_3 \delta }}{2x_1x_2} \end{aligned}$$

Proof

(1) We consider the infinite snake graph \(\mathcal {G}[\overline{1,3}]\), with labels as in Figure 3. Then, \(H_{2i-1}\) for \(i \ge 1\) is a single edge with label \(x_3\) while \(H_i\) for even i is as below.

figure q

We have that \(\chi (H_{2i-1}) = x_3\) and \(\chi (H_{2i}) = \frac{x_1^2x_2 + x_1x_2^2 + x_1x_2x_3}{x_1x_2} = x_1 + x_2 + x_3 = :\delta \). Moreover, \(b_{2i-1} = x_1\) and \(b_{2i} = x_2\). Thus, \(L_1 = \frac{x_3}{x_2}\) and \(L_2 = \frac{\delta x_2}{x_1^2}\); moreover, we can see from the periodicity of the terms \(\chi (H_i)\) and \(b_i\) that \(L_{2i+1} = \frac{x_1^2}{x_2^2} L_{2i-1}\) and \(L_{2i+2} = \frac{x_2^2}{x_1^2} L_{2i}\).

We first determine that \([L_1,L_2,\ldots ]\) converges for any values \(x_1,x_2,x_3 \in \mathbb {R}_{>0}\). This uses an argument similar to Lemma 7.2 in [8]. We know \([L_1,L_2,\ldots ,]\), with all \(L_i\) evaluated at a choice of real numbers \(x_1,x_2,x_3\), converges if and only if \(\sum _{i \ge 1} L_i\) diverges. We in fact can show that \(\lim _{i \rightarrow \infty } L_i \ne 0\). The limit of the even-indexed terms \(L_{2i}\) is given by \(\lim _{i\rightarrow \infty } \bigg ( \frac{x_2^2}{x_1^2} \bigg )^i \frac{\delta x_2}{x_1}\) while the limit of the odd-indexed terms is given by \(\lim _{i\rightarrow \infty } \bigg ( \frac{x_1^2}{x_2^2} \bigg )^i \frac{x_3}{x_2}\). It is not possible for both of these limits to converge; thus, the sequence \(\{L_i\}\) diverges and \([L_1,L_2,\ldots ]\) converges for any choice of positive real numbers \(x_1,x_2,x_3\).

Therefore, to calculate the infinite continued expression \([L_1,L_2,L_3,\ldots ]\), we can use Lemma 9 with \(z_1 = L_1 =\frac{x_3}{x_2}\), \(z_2 = L_2 = \frac{\delta x_2}{x_1^2}\), and \(r = \frac{x_1^2}{x_2^2}\). We have that L equals the expression in the statement of the Proposition by noting that we assume \(x_1,x_2,x_3 \in \mathbb {R}_{>0}\). By Theorem 6.3 of [8], this is equal to the limit of the ratio of \(\chi (G_{\frac{1}{q}})\) and \(\chi (\hat{G}_{\frac{1}{q}})\).

(2) Throughout this part, we assume \(q>>0\); a few claims may not hold for small q. If we want to consider the ratio of \(x_{\frac{1}{q}} = \chi (G_{\frac{1}{q}})\) and \(x_{\frac{1}{q-1}} = \chi (G_{\frac{1}{q-1}})\), we can use the same method as part (1), but swap the sign chosen on the first tile so that the associated infinite continued fraction is \([4,\overline{1,3}]\); this guarantees that the snake graph resulting from removing \(H_1\) from \(G_\frac{1}{q}\) is equal to the snake graph \(G_{\frac{1}{q-1}}\). We will use prime marks \('\) to denote the quantities in this part, and then we will compare the quantities to those in part (1). We have, for \(i \ge 1\), \(H_{2i}' = H_{2i+1}\) and \(H_{2i+1}' = H_{2i+2}\). The subgraph \(H_1'\) consists of the first three tiles of \(G_{\frac{1}{q}}\), as in Figure 3, and \(\chi (H'_1) = \frac{(x_1x_2x_3 \delta + x_1^2x_2)}{x_1^2x_2} = \frac{x_3\delta + x_1x_2}{x_1}\). Moreover, we have \(b'_0 = x_3\), and for \(i \ge 1\), \(b'_{2i-1} = x_2\) and \(b'_{2i} = x_1\). Thus, we have that \(L'_1 = \frac{x_3\delta + x_1x_2}{x_1x_2}, L'_2 = \frac{x_2 x_3}{x_1x_3} = \frac{x_2}{x_1}, L'_3 = \frac{\delta x_1x_3}{x_2^3}\), and for \(i \ge 1,\) \(\frac{L'_{2i+2}}{L'_{2i}} = \frac{x_2^2}{x_1^2} \) and \( \frac{L'_{2i+3}}{L'_{2i+1}} = \frac{x_1^2}{x_2^2}.\)

Since these ratios are the same as in part 1, we can use the same reasoning to show that \([L_1',L_2',\ldots ]\) converges for any choice of positive real numbers \(x_1,x_2,x_3\). Therefore, we have that

$$\begin{aligned} L' := \lim _{q \rightarrow \infty } \frac{x_{\frac{1}{q}}}{x_{\frac{1}{q-1}}}&= [L_1',L_2',L_3',\ldots ]\\&= L_1' + \frac{1}{[L_2',L_3',\ldots ]} \\ \end{aligned}$$

Then, we can compute \(\overline{L}' = [L_2',L_3',\ldots ]\) with Lemma 9 by setting \(z_1 = L_2' = \frac{x_2}{x_1}\), \(z_2 = L_3' = \frac{\delta x_1x_3}{x_2^3}\) and \(r = \frac{x_2^2}{x_1^2}\). By choosing the positive square root, we have that

$$\begin{aligned} \overline{L}' = \frac{x_2(x_2^2 + \delta x_3 - x_1^2) + x_2 \sqrt{(x_1^2 - x_2^2 - \delta x_3)^2 + 4 \delta x_1^2x_3}}{2\delta x_1x_3}. \end{aligned}$$

Since \(L' = [L_1,\overline{L}']\), the statement follows after further algebraic manipulations. \(\square \)

4.3 Generalized Markov numbers for \(\frac{q-1}{q}\)

Here we present some analogues results to Section 4.2 for the sequence \(\{m_{\frac{q-1}{q}}\}_q\). This sequence for the ordinary case is known to consist of every other Pell number. We begin with a linear recurrence which again allows us to compute the limiting behavior of the ratio of consecutive terms.

Proposition 5

Set \(m_{\frac{0}{1}} = 1\) and \(m_{\frac{1}{2}} = 3\). Then for \(q \ge 3\), we have

$$\begin{aligned} m_{\frac{q-1}{q}} = 17 m_{\frac{q-2}{q-1}} - m_{\frac{q-3}{q-2}} - 3 \end{aligned}$$

Proof

Let \(q \ge 3\). We reach a Farey tuple with \(\frac{q-1}{q}\) by exchanging \(\frac{q-3}{q-2}\) in the tuple \((\frac{1}{1}, \frac{q-3}{q-2}, \frac{q-2}{q-1})\). The proof follows the same reasoning as the proof of Proposition 2, using the fact that \(m_{\frac{1}{1}} = 3\). \(\square \)

In the ordinary case, we have initial conditions \(n_{\frac{0}{1}} = 1, n_{\frac{1}{2}} = 2\), and for \(q \ge 3,\) the recurrence \(n_{\frac{q-1}{q}} = 6n_{\frac{q-2}{q-1}} - n_{\frac{q-3}{q-2}}\).

Proposition 6

$$\begin{aligned} \lim _{q \rightarrow \infty } \frac{m_{\frac{q-1}{q}}}{m_{\frac{q-2}{q-1}}} = \frac{17 + \sqrt{285}}{2} \end{aligned}$$

The corresponding limit in the ordinary Markov case is \(\lim _{q \rightarrow \infty } n_{\frac{q-1}{q}}/n_{\frac{q-2}{q-1}} = 3 + 2\sqrt{2}\).

We next give an explicit description of the continued fractions \(C_{\frac{q-1}{q}}\). In the ordinary case, these are \([2,2,\ldots ,2]\) with an even number of terms 2.

Lemma 10

Let \(\beta \) be [3, 5]. Let \(q \ge 2\). Then, if q is even, \(C_{\frac{q-1}{q}} = \mathcal {N}[\beta ^{\frac{q-2}{2}},3, 4, (\beta ^{-1})^{\frac{q-2}{2}}]\). If q is odd, then \(C_{\frac{q-1}{q}} = \mathcal {N}[\beta ^{\frac{q-3}{2}},3, 5, 4,3,(\beta ^{-1})^{\frac{q-3}{2}}]\).

Proof

First consider a portion of the arc \(\gamma _{\frac{q-1}{q}}\) sufficiently to the left of the central crossing point. Since the slope of the arc is closer to 1 than 0, it passes close to the lattice points on its left and far from the lattice points on its right. This produces the \(3,5,3,5,\ldots \) behavior. The central terms follow from Lemma 7, picking a convention for the central crossing point, and by symmetry we see that to the right of the central crossing point we again have the pattern \(3,5,3,5,\ldots \). \(\square \)

One could use the same ideas as in Proposition 4 to compute the limit of generalized cluster variables \(\lim _{q \rightarrow \infty } \frac{x_{\frac{q-1}{q}}}{x_{\frac{q-2}{q-1}}}\). As is necessary in the proof of 6, this could be done by considering the product of two continued fractions of Laurent polynomials. We do not record this result as the polynomial has many terms and no clear factorization.

4.4 Other interesting families

The previous two sections looked at the sequences of generalized Markov numbers whose labels converged to 0 and 1. One could also pick a rational number r between 0 and 1 and look at Markov numbers whose indices converge to r. However, when the number is strictly between 0 and 1, there will be two options; one sequence which approaches from above and one which approaches from below. For example, given the number \(\frac{1}{2}\), one could consider the sequences \(\{m_{\frac{q}{2q-1}}\}_q\) and \(\{m_{\frac{q}{2q+1}}\}_q\). By similar reasoning to Lemmas 8 and 10, for large q, \(C_{\frac{q}{2q-1}}\) approaches the infinite continued fraction \([3, 4, 5, \overline{1, 2, 4, 5}]\) and \(C_{\frac{q}{2q+1}}\) approaches \([\overline{4,2,1,5}]\). One could use these to show growth behavior and, with some knowledge about how to form snake graphs from orbifolds, one could also compute limits of ratios of cluster variables corresponding to these infinite continued fractions.

It is straightforward to give linear recurrences as well for these families. The terms approaching \(\frac{1}{2}\) from above can be found in Markov triples \((m_{\frac{1}{2}}, m_{\frac{q-1}{2q-3}}, m_{\frac{q}{2q-1}})\). With the same reasoning as in Propositions 2 and 5, we can show that

$$\begin{aligned} m_{\frac{q}{2q-1}} = 77 m_{\frac{q-1}{2q-3}} - m_{\frac{q-2}{2q-5}} - 13 \end{aligned}$$

with initial conditions \(m_{\frac{1}{2}} = 13\) and \(m_{\frac{2}{3}} = 217\). The recurrence is in fact the same for the sequence \(\{m_{\frac{q}{2q+1}}\}_q\), but the initial conditions are different.

5 Extending the algorithm

In order to provide a partial proof of the famous uniqueness conjecture, the authors of [19] extend the correspondence between ordinary Markov numbers and rational numbers to include an assignment of numbers to integer points (kqkp) for \(\gcd (p,q) = 1\) and \(k \in \mathbb {Z}\). Geometrically, they take the line segment between (0, 0) and (kqkp), and deform the line segment slightly to the left or right at each lattice point (mqmp) for \(1 \le m < k\). The deformation moves to the same side at each intermediate point. They show that the two snake graphs one gets from choosing a left or right deformation have the same number of perfect matchings, and they associate this number to the point (kqkp). When \(k = 1\), this is just the Markov number \(n_{\frac{q}{p}}\).

We consider these left or right deformed arcs in our setting as well. For clarity, we sometimes replace notation using \(\frac{p}{q}\) with (qp) so that it is clear that our assignment of a number to (kqkp) is distinct from an assignment to (qp). Recall that if \(\gamma _{\frac{p}{q}}\) is the line segment from (0, 0) to (qp) with \(\gcd (p,q) = 1\), there is an intersection between \(\gamma _{\frac{p}{q}}\) and a line segment \(\tau \) in the lattice which occurs at the midpoint of \(\tau \). This meant that the middle entry of \(\textbf{f}(\frac{p}{q})\) could be \(+\) or −, and this choice would not affect the numerator of the continued fraction associated to \(\textbf{f}(\frac{p}{q})\). However, now if we consider an arc from (0, 0) to (kqkp) with \(k > 1\), and if we deform our arc to the left (right) at the points (iqip) for \(1 \le i \le k-1\), we will always assign \(+\) (−) to the central crossing point between each pair of lattice points \(((i-1)q,(i-1)p)\) and (iqip) since the deformation means this crossing point is now slightly to the left (right) of the midpoint. Then, by considering the crossing sequence as our arc makes a small half circle to the left of a lattice point, we see that if \(C_{(q,p)} = C_{\frac{p}{q}} = [a_1,\ldots ,a_n]\), then \(C^L_{(kq,kp)} = [a_1,\ldots ,a_n,5,1,a_1-1,\ldots ,a_n,5,\ldots ,1,a_1-1,\ldots ,a_n]\) such that there are \(k-1\) entries of 5 that connect two segments of the form \(a_1,\ldots ,a_n\) or \(1,a_1 - 1, \ldots ,a_n\). If we instead consider deforming the midpoint to the right, then \(C^R_{(kq,kp)} = [a_1,\ldots ,a_n - 1,1,5,a_1,\ldots ,a_n-1,1,5,a_1,\ldots ,a_n]\).

The sequence \(C^L_{(kq,kp)}\) is equal to the reversal of \(C^R_{(kq,kp)}\). For example, consider \(\frac{p}{q} = \frac{2}{3}\). Then, since \(C_{\frac{2}{3}} = [3,4,5,3]\) or [3, 5, 4, 3], we have that \(C^L_{(kq,kp)} = [3,5,4,3,5,1,2,5,4,3]\) and \(C^R_{(kq,kp)} = [3,4,5,2,1,5,3,4,5,3]\). By Lemma 2, the numerators of these continued fractions are the same; hence, the choice of deforming to the right or left will not affect the assignment of the number \(m_{(kq,kp)}\). We choose to use left deformations as a convention.

For positive integers pqk with \(\gcd (p,q) = 1\), we set \(m_{(kq,kp)} = \mathcal {N}(C^L_{(kq,kp)})\). In the case of ordinary Markov numbers and a cluster algebra from a torus, the left or right deformed arc between (0, 0) and (kqkp) for \(k > 1\) would correspond to an arc on the torus with \((k-1)\) self-intersections. Thus, we could apply skein relations to resolve the self-intersections; this provides relations amongst the numbers \(n_{(kq,kp)}\). We show that our orbifold Markov numbers and their extensions, \(m_{(kq,kp)}\), satisfy the same types of relations. Since the resolution of a self-intersection results in a closed curve, we first discuss band graphs.

5.1 Generalized Markov band graphs

In this section, we define band graphs and give a formula for computing the number of perfect matchings of such graphs. For notation, let \(G = (G_1,\ldots ,G_m)\) be a snake graph on m tiles. Let \(S(G_i)\) be the south edge of \(G_i\), and define \(W(G_i),N(G_i),E(G_i)\) similarly.

We also recall the notion of minimal and maximal matchings. In [22], the authors show that the set of perfect matchings of a snake graph form a lattice. The minimal and maximal elements of this lattice correspond to the two matchings of a snake graph which only use boundary edges; these are edges which only border one tile of the graph. Deciding which is the minimal matching is up to a convention; we will use the convention that \(S(G_1)\) is always an edge in the minimal matching.

Band graphs were introduced in [22] to describe bases of cluster algebras of surface type. Given a snake graph \(G = (G_1,\ldots ,G_m)\), we form a band graph by gluing one of the edges \(e \in \{S(G_1),W(G_1)\}\) with one of the edges \(e' \in \{N(G_m),E(G_m)\}\) in such a way that e is in the minimal matching if and only if \(e'\) is not in the minimal matching. Therefore, there are two ways to form a band graph from a given snake graph G.

Given a band graph G, with vertices xy along the glued edge \(e = e'\), we say a perfect matching P is a good matching if \(e \in P\) or if the two edges in P which are adjacent to x and y, lie on the same side of the glued edge \(e = e'\). Good matchings of a band graph \(\widetilde{G}\) correspond to perfect matchings of the underlying snake graph G which use e or \(e'\). By construction, the minimal matching of G uses e and the maximal matching uses \(e'\), or vice versa, so these always descend to good matchings of the band graph \(\widetilde{G}\).

For convenience we introduce the idea of a dominant edge.

Definition 5

Let \(e \in \{S(G_1),W(G_1)\}\) be the unique edge whose two vertices are both only adjacent to \(G_1\). We call e dominant, and we call the other edge in \(\{S(G_1),W(G_1)\}\) non dominant. We similarly call the unique edge in \(\{N(G_m),E(G_m)\}\) with both vertices only adjacent to \(G_m\) dominant.

figure r

Each snake graph has two dominant edges. The following is straightforward.

Lemma 11

Let \(G = \mathcal {G}[a_1,\ldots ,a_n]\) where \(a_1 > 1\) and \(a_n > 1\).

  • If n is even, then either the minimal matching uses both dominant edges and the maximal matching uses neither dominant edge or vice versa.

  • If n is odd, then the minimal and maximal matchings each use exactly one dominant edge.

Proof

We induct on n; the values of \(a_i\) will not affect the statement. The claim is immediately true for \(n=1\) by analyzing minimal and maximal matchings on a zig-zag snake graph.

Now assume we have shown the claim for snake graphs \(\mathcal {G}[a_1,\ldots ,a_{n-1}]\) for any choices of \(a_i \in \mathbb {Z}_{>0}\), and consider a snake graph \(\mathcal {G}[a_1,\ldots ,a_{n}]\). Assume that n is even. Then, we know that the minimal matching of \(G' = \mathcal {G}[a_1,\ldots ,a_{n-1}+1]\) uses exactly one dominant edge. Suppose that this is the dominant edge on \(G_1\), so that we use the non dominant edge on the final tile of \(G'\). Call this final tile \(G_{m'}\). We form G by gluing the non-dominant edge of the first tile of \(G'' = \mathcal {G}[a_n]\) onto the dominant edge on \(G_{m'}\). Thus, we can complete the minimal matching on G by taking the minimal/maximal matching on \(G''\) which uses the non dominant edge on the first tile. By the base case, this matching of \(G''\) uses the dominant edge on its last tile. Therefore, in this case the minimal matching on G uses both dominant edges, which immediately implies that the maximal matching uses neither. The other cases can be proven similarly. \(\square \)

By considering the fact that the minimal and maximal matchings on G descend to good matchings for either choice of band graph coming from G, we have the following corollary to Lemma 11.

Corollary 3

Let \(G = \mathcal {G}[a_1,\ldots ,a_n]\).

  • If n is even, then either band graph arising from G involves gluing exactly one dominant edge.

  • If n is odd, then one band graph arising from G involves gluing neither dominant edge and the other involves gluing both dominant edges.

By Corollary 3, a band graph formed from \(\mathcal {G}[a_1,\ldots , a_n]\) is determined by knowing whether or not the dominant edge on \(G_1\) is the glued edge. We let \(\mathcal {G}^\circ _D[a_1,\ldots ,a_n]\) denote the band graph which involves gluing the dominant edge on \(G_1\) and \(\mathcal {G}^\circ _N[a_1,\ldots ,a_n]\) denote the band graph which involves gluing the non-dominant edge on \(G_1\). Similarly, let \(\mathcal {N}^\circ _X[a_1,\ldots ,a_n]\) be the number of good matchings of \(\mathcal {G}^\circ _X[a_1,\ldots ,a_n]\) for X either D or N.

Proposition 7

Let \(a_1,\ldots ,a_n\) be positive integers with \(a_1 > 1\) and \(a_n > 1\).

  1. 1.

    If n is even, then

    $$\begin{aligned} \mathcal {N}^\circ _D[a_1,\ldots ,a_n] = \mathcal {N}[a_1,\ldots ,a_n] - \mathcal {N}[a_2,\ldots ,a_n-1] \end{aligned}$$

    and

    $$\begin{aligned} \mathcal {N}^\circ _N[a_1,\ldots ,a_n] =\mathcal {N}[a_1,\ldots ,a_n] - \mathcal {N}[a_1-1,\ldots ,a_{n-1}] \end{aligned}$$
  2. 2.

    If n is odd , then

    $$\begin{aligned} \mathcal {N}^\circ _D[a_1,\ldots ,a_n] =\mathcal {N}[a_1,\ldots ,a_n] - \mathcal {N}[a_2,\ldots ,a_{n-1}] \end{aligned}$$

    and

    $$\begin{aligned} \mathcal {N}^\circ _N[a_1,\ldots ,a_n] =\mathcal {N}[a_1,\ldots ,a_n] - \mathcal {N}[a_1-1,\ldots ,a_n-1] \end{aligned}$$

    Note that in the \(n = 1\) case, \(\mathcal {N}^\circ _D[a_1] = a_1\) and \(\mathcal {N}^\circ _N[a_1] = 2\).

Proof

Each case is proven by counting the number of matchings of the un-glued snake graph G which do not lift to a good matching of the band graph B. These are exactly the matchings which do not use either of the edges which are identified to form the band graph. When we have a dominant edge in the gluing, then not using this dominant edge forces a minimal/maximal matching on the first or last section of G; hence, we are ignoring the first or last entry of the continued fraction. When a nondominant edge is in the gluing, then if we instead use the adjacent dominant edge we have not forced any additional edges to be used in the matching. \(\square \)

Other formulas for computing the number of good matchings of a band graph will appear in [2].

We use the results above to analyze the number of perfect matchings of band graphs coming from the arcs \(\gamma _{(q,p)} = \gamma _{\frac{p}{q}}\). Following Sect. 4.3 of [9], we take the arc \(\gamma _{\frac{p}{q}}\) and nudge both endpoints an infinitesimal amount away from the lattice point to the points \((\epsilon ,\epsilon )\) and \((q+\epsilon ,p+\epsilon )\) for small \(\epsilon >0\); we also change the arc so that it no longer passes through (qp) by nudging the path to the left or right, as in the case of arcs \(\gamma _{(kq,kp)}\). Then, we identify these points; this corresponds to a simple (i.e. without self-intersections) closed curve in the orbifold \(\mathcal {O}_3\).

Let \(\gamma ^{L, \circ }_{\frac{p}{q}}\) and \(\gamma ^{R, \circ }_{\frac{p}{q}}\) be these two arcs with identified endpoints, and let \(m^{L, \circ }_{\frac{p}{q}}\) and \(m^{R, \circ }_{\frac{p}{q}}\) be the number of good matchings of the corresponding band graphs. Call these band graphs \(G^{L,\circ }_{\frac{p}{q}}\) and \(G^{R,\circ }_{\frac{p}{q}}\). The proof of Theorem 8 will describe the structure of these graphs and show that \(m^{L,\circ }_{\frac{p}{q}} = m^{R,\circ }_{\frac{p}{q}}\).

Theorem 8

For \(p,q \in \mathbb {Z}_{>0}\) with \(p \le q\) and \(\gcd (p,q) = 1\), we have

$$\begin{aligned} m^{L, \circ }_{\frac{p}{q}} = m^{R, \circ }_{\frac{p}{q}}= 6 m_\frac{p}{q}-1. \end{aligned}$$

Proof

We consider \(p = q=1\) separately. The arc \(\gamma _{\frac{1}{1}}\) only crosses one arc, \(\tau _{\frac{-1}{1}}\), so \(G_{\frac{1}{1}} = \mathcal {G}[3]\). The sign sequence for \(\gamma ^{L,\circ }_{\frac{1}{1}}\), keeping the convention \(a_1 > 1\) and \(a_n>1\), is \(+++------\). Since the first arc that \(\gamma ^{L,\circ }_{\frac{1}{1}}\) crosses is \(\tau _{\frac{-1}{1}}\) and the last arc is \(\tau _{\frac{1}{0}}\), we will form the graph \(G^{L,\circ }_{\frac{1}{1}}\) by gluing the end tiles on the edges labeled \(\tau _{\frac{0}{1}}\). Thus, we can compute \(m_{\frac{1}{1}}^{L,\circ }\) once we determine whether this edge is dominant on the first tile. Using the convention that the orientation of the labels of the first tile should match the orientation of the lattice (and of \(\mathcal {O}\)), we see that the edge labeled \(x_{\frac{0}{1}}\) on the first tile is the non-dominant edge. By Proposition 7, \(m^{L,\circ }_{\frac{1}{1}} = \mathcal {N}^\circ _N[3,6] = \mathcal {N}[3,6] - \mathcal {N}[2] = 17.\)

figure s

If we instead consider \(\gamma ^{R,\circ }_{\frac{1}{1}}\), then the sign sequence is \(---++++++\). The last arc that \(\gamma ^{R,\circ }_{\frac{1}{1}}\) crosses is instead \(\tau _{\frac{0}{1}}\), and the first two tiles of \(G^{R,\circ }_{\frac{1}{1}}\) are glued vertically instead of horizontally. Thus, \(m^{L,\circ }_{\frac{1}{1}} = \mathcal {N}^\circ _N[3,6]\) as well.

Now consider \(\frac{p}{q} < 1\). The first arc \(\gamma ^{L,\circ }_\frac{p}{q}\) crosses is \(\tau _{\frac{-1}{1}}\) and the last arc \(\gamma ^{L,\circ }_\frac{p}{q}\) crosses is \(\tau _{\frac{1}{0}}\). Thus, we know that the band graph \(G^\circ _\frac{p}{q}\) glues along \(\tau _{\frac{0}{1}}\). For \(\frac{p}{q}<1\) the first two entries of the sign sequence will be \(--\), regardless of the direction of nudging. This implies that the first two tiles will always be glued vertically, as below. Thus, we will be gluing along the dominant edge on the first tile.

figure t

We next evaluate how the continued fraction associated to \(\gamma _{\frac{p}{q}}^{L,\circ }\) compares with that for \(\gamma _{\frac{p}{q}}\). As mentioned above, at the central crossing point for \(\gamma _{\frac{p}{q}}\), we now use \(+\) since this crossing is now slightly closer to the left endpoint. Then, by similar reasons as for arcs \(\gamma ^L_{(kq,kp)}\), we see that if \(C_{\frac{p}{q}} = [a_1,\ldots ,a_1]\), then \(C_{\frac{p}{q}}^{L,\circ } = [a_1,\ldots ,a_1,6]\) where \(C_{\frac{p}{q}}^{L,\circ }\) gives the continued fraction from the sign sequence for the arc \(\gamma ^L_{(kq,kp)}\) ignoring the identification. Thus, we have that \(m_{\frac{p}{q}}^{L,\circ } = \mathcal {N}_D^\circ [a_1,\ldots ,a_1,6]\).

We know that n is even, so we can compute this using Proposition 7,

$$\begin{aligned} \mathcal {N}^\circ _D[a_1,\ldots ,a_1,6] = \mathcal {N}[a_1,\ldots ,a_1,6] - \mathcal {N}[a_2,\ldots , a_1]. \end{aligned}$$

By Lemma 3, we further manipulate the first term,

$$\begin{aligned} \mathcal {N}^\circ _D[a_1,\ldots ,a_1,6] = 6 \mathcal {N}[a_1,\ldots ,a_1] + \mathcal {N}[a_1,\ldots ,a_2] - \mathcal {N}[a_2,\ldots ,a_1]. \end{aligned}$$

Since \(\mathcal {N}[a_1,\ldots ,a_1] = m_{\frac{p}{q}}\), we are left with showing \(\mathcal {N}[a_1,\ldots ,a_2] - \mathcal {N}[a_2,\ldots ,a_1] = -1\). First, suppose that the number of terms in \(a_1,\ldots ,a_2\) is \(4\ell -1\) for some \(\ell \ge 1\). Then, we have that \(C_{\frac{p}{q}}^{L,\circ } = a_1,a_2,\ldots , a_{2\ell } + 1, a_{2\ell }, \ldots , a_2,a_1,6\), since even-indexed entries count the length of subsequences of \(+\)’s and we assign \(+\) to the central crossing point. Thus, by Lemma 5, \(\mathcal {N}[a_1,\ldots ,a_2] - \mathcal {N}[a_2,\ldots ,a_1] = -c_{2\ell } = -1\).

Next, suppose that the number of terms in \(a_1,\ldots ,a_2\) is \(4\ell + 1\). Then, \(C_{\frac{p}{q}}^{L,\circ } = a_1,a_2,\ldots , a_{2\ell +1}, a_{2\ell +1}+1, \ldots , a_2,a_1,6\), so

$$\begin{aligned} \mathcal {N}[a_1,\ldots ,a_{2\ell +1}, a_{2\ell +1}+1, \ldots , a_2] - \mathcal {N}[a_2,\ldots ,a_{2\ell +1}, a_{2\ell +1}+1, \ldots , a_1]\\ =\mathcal {N}[a_2,\ldots ,a_{2\ell + 1} + 1, a_{2\ell + 1},\ldots ,a_1] - \mathcal {N}[a_1,\ldots ,a_{2\ell + 1} + 1, a_{2\ell + 1},\ldots ,a_1]\\ = c_{2\ell + 1} = -1, \end{aligned}$$

where we again apply Lemma 5.

Next we turn to \(\gamma _{\frac{p}{q}}^{R,\circ }\). As when analyzing arcs \(\gamma _{(kq,kp)}^R\), we have that if \(C_{\frac{p}{q}} = [a_1,\ldots ,a_1]\), then \(C_{\frac{p}{q}}^{R,\circ } = [a_1,\ldots ,a_1-1,1,6]\). In this case, the first arc \(\gamma _{\frac{p}{q}}^{R,\circ }\) crosses is \(\tau _{\frac{-1}{1}}\) and the last arc crossed is \(\tau _{\frac{0}{1}}\). Therefore, we form \(G_{\frac{p}{q}}^{R,\circ }\) by gluing along the edge labeled with \(\tau _{\frac{1}{0}}\) on the first tile; this is the non-dominant edge. Therefore, \(m_{\frac{p}{q}}^{R,\circ } = \mathcal {N}_N^\circ [a_1,\ldots ,a_1-1,1,6]\). Since the number of terms is even, by Proposition 7 we have that

$$\begin{aligned} \mathcal {N}_N^\circ [a_1,\ldots ,a_1-1,1,6]&= \mathcal {N}[a_1,\ldots ,a_1-1,1,6] - \mathcal {N}[a_1-1,\ldots ,a_1-1,1]\\&= 6\mathcal {N}[a_1,\ldots ,a_1-1,1] + \mathcal {N}[a_1,\ldots ,a_1-1] \\ {}&- \mathcal {N}[a_1-1,\ldots ,a_1-1,1]\\&= 6 m_{\frac{p}{q}} + \mathcal {N}[a_1,\ldots ,a_1-1] - \mathcal {N}[a_1-1,\ldots ,a_1] \end{aligned}$$

We can rewrite

$$\begin{aligned}{} & {} \mathcal {N}[a_1,\ldots ,a_1-1] - \mathcal {N}[a_1-1,\ldots ,a_1] = \mathcal {N}[1,a_1-1,\ldots ,a_1-1] \\{} & {} \quad - \mathcal {N}[a_1-1,\ldots ,a_1-1,1], \end{aligned}$$

and then by a similar argument as before, using Lemma 5, we can show that \(\mathcal {N}[1,a_1-1,\ldots ,a_1-1] - \mathcal {N}[a_1-1,\ldots ,a_1-1,1] = -1\). \(\square \)

Seeing in Theorem 8 that our choice of direction to navigate around the lattice point does not matter, we now will write \(m_{\frac{p}{q}}^{\circ } = m_{\frac{p}{q}}^{L,\circ } = m_{\frac{p}{q}}^{R,\circ }\). In [9], the authors show that for ordinary Markov numbers and arcs on a torus, \(n^\circ _\frac{p}{q}= 3n_\frac{p}{q}\).

5.2 Recurrence on \(m_{(kq,kp)}\)

In the following, we show how \(m_{(kq,kp)}\) compares with \(m_{(q,p)}\).

Theorem 9

Let \(\frac{p}{q} \le 1\) have \(\gcd (p,q) = 1\). Let \(k \ge 2\), and define \(m_0 = 0\). Then,

$$\begin{aligned} m_{\frac{kp}{kq}} = m^\circ _{\frac{p}{q}} m_{\frac{(k-1)p}{(k-1)q}} - m_{\frac{(k-2)p}{(k-2)q}}. \end{aligned}$$

Proof

We will show this relation by using snake graph calculus, which was introduced in [6]; we will look at resolving snake graphs with “self-intersection”, which was explained in a follow-up work [7]. We will use notation from [7] and invite the interested reader to consult this source for more precise definitions.

Given a snake graph \(G = (G_1,\ldots ,G_d)\), for \(i \le j\), let G[ij] be the subgraph \((G_i,\ldots ,G_j)\).

We consider the \(k = 2\) case separately. In this case, we expect that \(m_{(2q,2p)} = m_{(q,p)}^\circ m_{(q,p)}\). If \(G_{(q,p)}\) has d tiles, then \(G_{(2q,2p)}\) has \(2d + 6\) tiles. Naturally, the subgraphs \(G_{(2q,2p)}[1,d]\) and \(G_{(2q,2p)}[d+7,2d+6]\) are isomorphic. Call this graph \(\mathcal {G}\). The two inclusions \(i_1\) and \(i_2\) a of \(\mathcal {G}\) into \(G_{(kq,kp)}\) are maximal in the sense that there is no pair of larger isomorphic subgraphs of \(G_{(2q,2p)}\) which contain \(i_1(\mathcal {G})\) and \(i_2(\mathcal {G})\). This shows \(G_{(2q,2p)}\) has a self-overlap in the sense of [7]. Since the inclusions \(i_1,i_2\) both map the southwest-most tile of \(\mathcal {G}\) to the southwest most tile of the corresponding subgraphs, this self-overlap is in the same direction. We denote by s and t the labels of the first and last tiles of \(i_1(\mathcal {G})\); that is, \(s = 1\) and \(t = d\). Similarly, let \(s' = d+7\) and \(t' = 2d+6\) be the same indices for the first and last tiles of \(i_2(\mathcal {G})\).

Next, we check that \(G_{(2q,2p)}\) satisfies Definition 2.6 in [7]. Since \(s = 1\) and \(t' = 2d+6\), where our graph has \(2d+6\) tiles, we check that the sign on the internal edge between \(G_{t}\) and \(G_{t+1}\) (call this edge \(e_t\)) is the same as the sign on the internal edge between \(G_{s'-1}\) and \(G_s\) (\(e_{s'-1}\)).These signs correspond to the entries \(f_{t}\) and \(f_{s'-1}\) in the sign function \(\textbf{f}((2q,2p))\). By our convention, both of these entries will have sign \(+\), since they correspond to a crossings right before and after the small circle \(\gamma _{(2q,2p)}\) takes around (qp)).

Thus, \(G_{(2q,2p)}\) self-crosses. This allows us to follow the construction in [7] of a resolution of the crossing; this will give an equation relating the number of perfect matchings of several snake graphs.

  • First, we have that \(\mathcal {G}_3 = G[s,t] \cup G[t'+1,2d+6] = G[1,d]\); this is isomorphic to \(G_{\frac{p}{q}}\). By definition, the number of matchings of this subgraph is \(m_{\frac{p}{q}}\).

  • Next, \(\mathcal {G}_4^\circ \) is the band graph with underlying snake graph \(G[s, s'-1] = G[1,d+6]\) and (using a left nudge) which glues on the edges labeled with \(\tau _{\frac{0}{1}}\). From Theorem 8, the number of good matchings of this snake graph is \(m^\circ _{(q,p)}\).

  • Since \(s = 1\) and \(t = 2d+6\), where our graph has \(2d+6\) tiles, to find \(\mathcal {G}_{56}\) we are in subcase 2d of case 1 in Section 3 of [7]. Then, \(\mathcal {G}_{56}' = \overline{G}[d+7,d+1]\) where the overline denotes a reversal of the snake graph; this is a zig-zag on 6 tiles. We have that \(\mathcal {G}_{56}\) is the section of \(\mathcal {G}_{56}'\) between the first edge with the same sign as \(e_{s'-1}\) and the last edge with the same sign as \(e_t\). As discussed, each of these signs is \(+\). However, every interior edge of \(\mathcal {G}_{56}'\) has sign − since this subgraph corresponds to the portion of the arc which forms a small half-circle to the left of a point on the lattice, hence closer to the right endpoints of the arcs crossed. Therefore, \(\mathcal {G}_{56}\) is an empty graph with zero perfect matchings.

By Theorem 4.5 in [7], we conclude that \(m_{(2q,2p)} = m_{\frac{p}{q}} m_{\frac{p}{q}}^\circ \).

Now we turn to the case for \(k > 2\). The snake graph \(G_{(kq,kp)}\) has \((6+d)k -6\) tiles where each subgraph \(G_{(q,p)}[(d+6)(i-1) + 1, (d+6)i - 6]\) for \(1 \le i \le k\) is isomorphic to \(G_{(q,p)}\). The connected subgraphs of the complement, of the form \(G[(d+6)i - 5, (6+d)i]\) for \(1 \le i \le k-1\), each form a zig-zag shape. Therefore, the subgraphs \(G[1,(d+6)(k-1) - 6]\) and \(G[d+7, \ldots , (6+d)k -6]\) are isomorphic. Call this subgraph \(\mathcal {G}\); by the same reasoning as in the \(k=2\) case, we see that \(G_{(kq,kp)}\) has a self-overlap in the same direction, and this counts as a self-crossing. Here, we set \(s = 1, t =(d+6)(k-1) - 6, s' = d+7,\) and \(t' = (d+6)k -6\). The computations for \(\mathcal {G}_3\) and \(\mathcal {G}_4^\circ \) are similar to the \(k=2\) case while the analysis for the graph \(\mathcal {G}_{56}\) is different.

  • The graph \(\mathcal {G}_3\) is \(G[1,t] = [1,(d+6)(k-1)-6]\), which is the same as the graph \(G_{((k-1)q,(k-1)p)}\). Thus, \(\eta (\mathcal {G}_3) = m_{((k-1)q,(k-1)p)}\).

  • The band graph \(\mathcal {G}_4^\circ \) has underlying graph \(G[s,s'-1] = G[1,d+6]\) and is glued on the edges on the extreme tiles labeled with \(\tau _{\frac{0}{1}}\). Just as in the \(k = 2\) case, \(\eta (\mathcal {G}_4^\circ ) = m_{(q,p)}^\circ \).

  • Since \(s' < t\) for \(k > 2\), we are now in Subcase 1 of Case 1 in Section 3.2 of [7], so \(\mathcal {G}_{56} = -G[s',t] = -G[d+7,(d+6)(k-1)-6]\), where we have that \(\eta (-G) = -\eta (G)\). Thus, we have that \(\eta (\mathcal {G}_{56}) = -m_{(k-2)q,(k-2)p}\).

Therefore, by Theorem 4.12 in [7], we have that

$$\begin{aligned}m_{(kq,kp)} = \eta (G_{(kq,kp)}) = m_{((k-1)q,(k-1)p)}m_{(q,p)}^\circ - m_{((k-2)q,(k-2)p)}. \end{aligned}$$

\(\square \)

Define the family of (normalized) Chebyshev polynomials of the second kind by \(U_0(x) = 1, U_1(x) = x\), and for \(k \ge 2\), \(U_k(x) = xU_{k-1}(x) - U_{k-2}(x)\). By repeated use of Theorem 9 and Theorem 8 we can also express \(m_{(kq,kp)}\) completely in terms of \(m_{(q,p)} = m_{\frac{p}{q}}\).

Corollary 4

Let \(p \le q\) satisfy \(\gcd (p,q) = 1\). Let \(k \ge 1\). Then,

$$\begin{aligned} m_{(kq,kp)} = U_{k-1}(m^\circ _{(q,p)}) m_{(q,p)} = U_{k-1}(6m_{(q,p)} - 1) m_{(q,p)} . \end{aligned}$$

For example, from Table 1, \(m_{3,3} = \mathcal {N}[3,5,3,53] = 846 = U_2(m^\circ _{(1,1)}) m_{(1,1)} =3 U_2(17)\).

6 Other diophantine equations

In [18], Gyoda and Matsushita study Diophantine equations of the form

$$\begin{aligned} x^2 + y^2 + z^2 + k_1x + k_2y + k_3z \end{aligned}$$

for nonnegative integers \(k_1,k_2\) and \(k_3\); one can see \(k_1 = k_2 = k_3 = 0\) is the ordinary Markov equation and \(k_1 = k_2 = k_3 = 1\) is our generalized Markov equation. They show that for any choice of \(k_1,k_2,k_3\), the solution set is reachable by exchanges akin to those in Theorem 1. It is likely that our results could be extended to other choices of \(k_i\).

If all \(k_i \in \{0,1\}\), one can find a related geometric model, including orbifold points of order two and three, which yields a cluster algebra whose variables specialize to the solutions of the equation. To deal with orbifold points of order two, one can consult [10]. If we have \(k_i \ne k_j\) for some pair ij, there will be an asymmetry in the variables xyz, so one may need a larger indexing set than \(\mathbb {Q} \cap [0,1]\). Nonetheless, there should still be nice patterns in this case, which potentially can be refined to cluster-algebraic expressions as in Proposition 4.

In order to preserve the symmetry, one could instead study the case \(k_1 = k_2 = k_3 = d \in \mathbb {Z}_{>1}\). In this case, one could use the same snake graph construction as motivated our work here, but some of the internal edges of the snake graph would have to be weighted by d. The connection between snake graphs and continued fractions only handles snake graphs with all edges having weight 1. It is possible that one could replace each weight d edge with a larger subgraph with edges of weight 1, and then compute with continued fractions.