1 Introduction

In a recent paper [12] Ekhad and Zeilberger numerically investigated several problems on the asymptotic enumeration of lattice paths. This has led to many conjectures, among which we will answer some in this note. They are all related to generalizations of the famous ballot problem which we present now.

The ballot problem is probably one of the oldest problems on lattice path enumeration. There exist various formulations, yet all of them have the following question in common: Consider an election between two candidates, say A and B, who both receive n votes. What is the probability that A is never behind B during the count? The result is surprisingly simple:

$$\begin{aligned} \frac{1}{n+1}. \end{aligned}$$

The first reported answer was given by Bertrand [4] in 1887, which was shortly after also rigorously proved by André [1]. Let us call the sequence of possible countings leading to a tie a ballot sequence. Then, what lies behind this beautiful result, is the fact that the total number of votes are counted by the famous Catalan numbers

$$\begin{aligned} \frac{1}{n+1} \left( {\begin{array}{c}2n\\ n\end{array}}\right) . \end{aligned}$$
(1)

A proof strategy consists in reformulating this question into one about lattice paths in the integer lattice \({\mathbb Z}^2\). We model a vote for A by a unit step in x-direction (1, 0) and a vote for B by a unit step in y-direction (0, 1). The paths start at the origin (0, 0) and end at (nn). We are then interested in the total number of paths that are constrained to the region

$$\begin{aligned} \left\{ (x,y) \in {\mathbb Z}^2~:~x \ge y \right\} . \end{aligned}$$

These paths are also famously known as Dyck paths, being obviously enumerated by the Catalan numbers [19]. For more on the ballot problem and the history of lattice paths we refer to the beautiful surveys by Humphreys [17] and Krattenthaler [18].

As an answer to such questions, one strives for the most detailed possible one. Most desirable is therefore a closed-form expression such as (1). Often, however, this does not exist or is very complicated but we are still sometimes able to derive its asymptotics. Let \(a_n\) be the number of paths of length n. Then for “well-behaved” sequences we expect for \(n\rightarrow \infty \) the structureFootnote 1

$$\begin{aligned} a_n \sim C \, \mu ^n \, n^\alpha , \end{aligned}$$
(2)

where C is a constant, \(\mu \) the exponential growth, and \(\alpha \) the critical exponent. Note that general sequences may include additional terms such as n!, \(n^n\), or more complicated terms such as \(\mu ^{n^{\sigma }}\) known as stretched exponentials [13]. In the context of this note, the structure (2) will suffice.

Now the ballot problem can be generalized in many ways. For our purposes, let \(a,b \in {\mathbb Z}_{>0}\) be two positive integers that are relatively prime. Then, we consider walks with positive unit steps as above that go from the origin (0, 0) to the point (anbn) and are constrained to the region \(bx - ay \ge 0\). The special case \(a=b=1\) gives the ballot sequence enumerated by Catalan numbers, while \(a=1\) and general b leads to Fuss–Catalan numbers [18]. The asymptotics of the general problem is answered in [3] and can be tricky due to possible cancellations (see for example the conjecture by KnuthFootnote 2 for \(a=2\) and \(b=5\) answered therein). What is remarkable in these 2-dimensional models is the universality of the critical exponent \(\alpha \), in the sense that it is independent of the chosen model and always equal to \(-3/2\).

A natural next step is to ask the same question in higher dimensions. Here the critical exponent is not universal as we will see below and many open questions remain. From now on we focus on generalized ballot sequences in 3 dimensions which count the following:

Definition 1.1

(Generalized 3-ballot walks) Let \(a,b,c \in {\mathbb Z}_{>0}\) be positive integers such that \(\gcd (a,b,c)=1\) and \(M={\text {lcm}}(a,b,c)\). Generalized 3-ballot walks are walks from the origin (0, 0, 0) to (anbncn) using unit steps \((1,0,0), (0,1,0), (0,0,1)\) that are constrained to stay in the region

$$\begin{aligned} Ax&\ge By \ge Cz \ge 0,&\text { where }&A&:=\frac{M}{a},~ B:=\frac{M}{b},~ C:=\frac{M}{c}. \end{aligned}$$

Ekhad and Zeilberger [12] numerically computed the critical exponent \(\alpha \) for all models with \(1 \le a \le b \le c \le 4\). We will derive closed forms for these values, show that all except \(a=b=c=1\) are irrational, and explain why this suffices to show that the corresponding generating function is not D-finite. Note that a generating function is D-finite if it satisfies a linear differential equation with polynomial coefficients. This is equivalent to its counting sequence being P-recursive, i.e. it satisfies a linear recurrence relation with polynomial coefficients. For more information on these notions see [19].

Remark 1.2

The list in [12, page 5] unfortunately contains some typos. It does not state (abc) but \((A,B,C)\). Note that it may also be interpreted as \((C,B,A)\); see Lemma 3.1.

2 Closed forms for the numerical estimates of Ekhad–Zeilberger

The theory to derive the critical exponent comes from the enumeration of lattice paths in the quarter plane, i.e. the first quadrant [9]. As a first step we will map the 3-dimensional walks to the following class of 2-dimensional walks; see Fig.  1.

Definition 2.1

(Large tandem walks) Let \(A,B,C\in {\mathbb Z}_{>0}\) be positive integers such that \(\gcd (A,B,C)=1\). Large tandem walks are walks starting from the origin (0, 0) using the steps \((A,0), (-B,B), (0,-C)\) that are constrained to the quarter plane

$$\begin{aligned} \left\{ (x,y) \in {\mathbb Z}^2 : x,y\ge 0\right\} . \end{aligned}$$
Fig. 1
figure 1

3-ballot walks of the model \((a,b,c)=(2,3,6)\) are in bijection with large tandem excursions in the quarter plane with step set \(\{(3,0), (-2,-2), (0,-1)\}\); for more details see Lemma 2.2

The 2-dimensional walks with the step set \(\{(1,0),(-1,1),(0,-1)\}\) that are constrained to the quarter plane are called tandem walks and are connected to a wide range of research problems [5, 9, 10]. The name stems from queueing theory, as they indeed represent the behavior of two M/M/1 queues in “tandem”; see [14, Sect. 4.7].

The general step set \(\{ (A,0)\), \((-B,B)\), \((0,-C) \}\) consists for \((A,B,C)\ne (1,1,1)\) of large steps. Note that the steps \(\{-1,0,1\}^2\) are called small steps, all others are called large steps. Walks with large steps are substantially harder to count and the enumeration problem is still widely open. A lot of progress has recently been made by Bostan, Bousquet-Mélou, and Melczer [7] who developed a general theory for walks with large steps in the quarter plane. We will use this theory to derive closed forms for \(\alpha \). Remarkably, all that can be done fully automatically, as explained in [7, Sect. 8.2.1].

The following result gives an explicit bijection between generalized 3-ballot walks and large tandem excursions, where excursions are walks from the origin to the origin.

Lemma 2.2

The map \(\varphi : {\mathbb Z}^3 \rightarrow {\mathbb Z}^2\) defined by

$$\begin{aligned} \varphi : (x,y,z) \mapsto \left( Ax - By, By - Cz \right) \end{aligned}$$

is a bijection between generalized 3-ballot walks from Definition 1.1 and large tandem excursions of length 3n from Definition 2.1.

Proof

First, note that \(M={\text {lcm}}(a,b,c)={\text {lcm}}(A,B,C)\) due to \(\gcd (a,b,c)=\gcd (A,B,C)=1\). Thus, there is a one-to-one correspondence between (abc) and \((A,B,C)\): \(aA= bB= cC= M\). Second, note that instead of the absolute coordinates, the map keeps track of the weighted relative differences of the coordinates. Thereby, the space constraint \(Ax \ge By \ge Cz \ge 0\) implies that each 2D-coordinate is nonnegative and therefore lies in the quarter plane. Plugging the unit vectors into \(\varphi \) gives the new steps, while the starting point (0, 0, 0) and the end point (anbncn) both give (0, 0). As there is a one-to-one correspondence between the steps this gives the claimed bijection.

Before we continue we need to introduce some notation. We associate with a stepset \(\mathcal {S}\subset {\mathbb Z}^2\) a step polynomial \( S(x,y) = \sum _{(i,j) \in \mathcal {S}} x^i y^j. \) This gives in our case

$$\begin{aligned} S(x,y) = x^{A} + \left( \frac{y}{x}\right) ^{B} + \frac{1}{y^{C}}. \end{aligned}$$
(3)

Let \(e_n\) be the number of excursions of length n and let \(E(t) = \sum _{n \ge 0} e_n t^n\) be the generating function of excursions. We define the period p of excursions as \( p := \gcd \{n \in \mathbb {N}: e_n \ne 0\}\). In other words, it holds that \(E(t) = \sum _{m \ge 0} e_{pm} t^{pm}\). Observe that for large tandem excursions we have \(p = a+b+c\). Moreover, the origin (0, 0) is reachable from infinity if there exists a quadrant walk that starts from a point \((k,\ell ) \in {\mathbb Z}_{>0}^2\) and ends at (0, 0). Note that for large tandem excursions this is the case, e.g., for the point \((B,BC-B)\).

The main result we will need is the following adapted theorem which we state for excursions only.

Theorem 2.3

(Adapted [7, Theorem 7 and Theorem 11]; see also [11]) Let \(\mathcal {S}\subset {\mathbb Z}^2\) be a step set that is not contained in a half-plane and contains an element of \(\mathbb {N}^2\). Then the step polynomial S(xy) has a unique critical point (XY) in \({\mathbb R}_{>0}^2\) (that is, a solution of \(S_x(X,Y) = S_y(X,Y) = 0\)), which satisfies \(S_{xx}(X,Y) > 0\) and \(S_{yy}(X,Y) >0\). Define

$$\begin{aligned} \mu&= S(X,Y), \nonumber \\ \gamma&= \frac{S_{xy}(X,Y)}{\sqrt{S_{xx}(X,Y)S_{yy}(X,Y)}}, \\ \alpha&= -1 - \frac{\pi }{\arccos (-\gamma )}.\nonumber \end{aligned}$$
(4)

Furthermore, let (0, 0) be reachable from infinity. If the period of excursions satisfies \(p=1\), then there exists a positive constant \(\kappa \) such that, as n goes to infinity

$$\begin{aligned} e_{n}&\sim \kappa \, \mu ^{n} \, {n}^{\alpha }. \end{aligned}$$

If the period of excursions satisfies \(p>1\), then we have for \(n=pm\) large enoughFootnote 3

$$\begin{aligned} e_{n}&= \Theta \left( \mu ^{n} {n}^{\alpha } \right) . \end{aligned}$$

Then \(\alpha \) is called the critical excursion exponent. If \(\alpha \notin \mathbb {Q}\) (or, equivalently, \(\arccos (-\gamma )\) is not a rational multiple of \(\pi \)), then the series E(t) is not D-finite.

Remark 2.4

In [7] the authors consider the generating function \(Q(x,y;t) = \sum _{i,j,n \ge 0} q_{ijn} x^i y^j t^n\) where \(q_{ijn}\) is equal to the number of walks from (0, 0) to (ij) of length n restricted to the quarter plane. Then we have \(E(t) = Q(0,0;t)\) and as D-finite functions are closed under algebraic substitutions (see, e.g., [15]), Q(xyt) is not D-finite either if E(t) is not D-finite.

The authors of [7] have implemented the procedure to determine \(\gamma \) and \(\alpha \) in a publicly available Maple worksheetFootnote 4. More details of the involved methods are explained in [7, Sect. 8.2.1]. Using the associated \(\texttt {minPs}\) command we compute the closed forms of the critical exponents conjectured in [12] and list them in Table 1. Now using the arguments from [8] (which are also used in [7]) we directly get that the critical exponent \(\alpha \) is irrational in all cases, except for \((a,b,c)=(1,1,1)\), and hence the generating function E(t) (as well as \(E(t^{1/p})\)) is not D-finite. For the case \((a,b,c)=(1,1,1)\) of tandem excursions it is known that the generating function is D-finite (even hypergeometric); see [9, Proposition 9] and [16].

Table 1 Proved closed forms of the critical exponent \(\alpha \) of excursions for the conjectured values from [12, page 5]. As always, \(A=M/a\), \(B=M/b\), \(C=M/c\), and \(M={\text {lcm}}(a,b,c)\). Note that \(\alpha \) is irrational in all cases except the first, and therefore the excursions’ generating function is not D-finite

This gives the closed-form expressions requested in [12] and thereby makes the OEIS USD 100 richer. In the next section we go one step further and investigate the models associated with generalized 3-ballot walks, namely large tandem excursions, and uncover a surprisingly simple structure for \(\gamma \). This gives a tool to prove the non-D-finiteness of many such models.

3 Generalized 3-ballot walks and large tandem walks

As a first observation we note that the number of excursions is the same in the models \((A,B,C)\) and \((C,B,A)\). This follows from the following lemma.

Lemma 3.1

There exists a bijection between large tandem excursions in the models \((A,B,C)\) and \((C,B,A)\).

Proof

Let a large tandem excursion in the model \((A,B,C)\) be given. It is built from the step set \(\{(A,0), (-B,B), (0,-C)\}\). First, we reverse the time by reading the steps backwards. This gives the new step set \(\{ (-A,0)\), \((B,-B), (0,C) \}\). Second, we rotate along \(y=x\), and get the step set \(\{ (C,0)\), \((-B,B), (0,-A) \}\) corresponding to the model \((C,B,A)\). Note that both operations transform excursions into excursions and remain in the quarter plane. For more details and further transformations see [2].

Next we compute the critical excursion coefficient using Theorem 2.3. Observe the invariance in swapping \(A\) and \(C\) implied by Lemma 3.1.

Lemma 3.2

The exponential growth \(\mu \), the constant \(\gamma \), and the critical exponent \(\alpha \) from Equation (4) for large tandem excursions with the step set \(\{ (A,0), (-B,B), (0,-C) \}\) are equal to

$$\begin{aligned} \mu&= C\left( \frac{A^BB^A}{C^{A+B}}\right) ^{C/(AB+AC+BC)} \left( \frac{1}{A}+\frac{1}{B}+\frac{1}{C}\right) , \nonumber \\ \gamma&= -\frac{B}{\sqrt{(A+B)(B+C)}}, \\ \alpha&= -1 - \frac{\pi }{\arccos \left( B/\sqrt{(A+B)(B+C)} \right) }. \nonumber \end{aligned}$$
(5)

Proof

The step polynomial of large tandem walks is given in (3): \( S(x,y) = x^{A} + (\frac{y}{x})^{B} + \frac{1}{y^{C}}. \) According to Theorem 2.3 we need to compute the unique values \(X,Y>0\) such that \(S_x(X,Y)=S_y(X,Y)=0\). This gives the following equalities

$$\begin{aligned} AX^{A} = B\left( \frac{Y}{X}\right) ^{B} = C\frac{1}{Y^{C}}, \end{aligned}$$

where

$$\begin{aligned} X&= \left( \frac{B^CC^B}{A^{B+C}}\right) ^{1/(AB+AC+BC)}&\text {and}&Y&= \left( \frac{C^{A+B}}{A^BB^A}\right) ^{1/(AB+AC+BC)}. \end{aligned}$$

Using these relations we compute and simplify \(S_{xy}(X,Y)\), \(S_{xx}(X,Y)\), and \(S_{yy}(X,Y)\):

$$\begin{aligned} S_{xy}(X,Y)&= -B^2 \frac{Y^{B-1}}{X^{B+1}}, \\ S_{xx}(X,Y)&= A(A-1)X^{A-2} + B(B+1)\frac{Y^{B}}{X^{B+2}} = (A+B) B\frac{Y^{B}}{X^{B+2}}, \\ S_{yy}(X,Y)&= B(B-1)\frac{Y^{B-2}}{X^{B}} + C(C+1)\frac{1}{Y^{C+2}} = (B+C) B\frac{Y^{B-2}}{X^{B}}. \end{aligned}$$

Thus, using Formula (4) we get the claimed closed forms. Note that the specific values of X and Y are only needed for the determination of \(\mu \).

This remarkably simple formula allows us to determine many non-D-finite models.

Theorem 3.3

The generating function of large tandem walks (and in particular large tandem excursions) with parameters \((A,B,C)\) is not D-finite if

$$\begin{aligned} \frac{B^2}{(A+B)(B+C)} \notin \left\{ \frac{1}{4}, \frac{1}{2}, \frac{3}{4}\right\} . \end{aligned}$$

Proof

Building on the results of Lemma 3.2, it remains to determine whether \(\alpha \in \mathbb {Q}\), which is equivalent to \(\arccos (-\gamma )/\pi \in \mathbb {Q}\). There exist general classification results for the case that \(\gamma \) is a square root of a rational [20]: For \(r \in \mathbb {Q}\) with \(0< r < 1\), the value \(\arccos (\sqrt{r})/\pi \) is rational if and only if \(r \in \{1/4, 1/2, 3/4\}\). Hence, in our case everything depends on \(r = \gamma ^2 = \frac{B^2}{(A+B)(B+C)}\).

All possible rational values of \(\alpha \) are summarized in Table 2. It shows the only possible candidates for D-finite generating functions; all other cases are therefore proved to be non-D-finite.

Table 2 By Theorem 3.3 large tandem excursions and the bijectively equivalent generalized 3-ballot walks are not D-finite if \(\gamma ^2 = \frac{B^2}{(A+B)(B+C)} \notin \left\{ \frac{1}{4}, \frac{1}{2}, \frac{3}{4}\right\} \). The table lists the only 3 exceptional values for \(\gamma ^2\), the associated rational critical excursion exponents \(\alpha \), and examples exhibiting this behavior. The generating function of classical tandem excursions (1, 1, 1) is D-finite, while the nature of the other models is unknown

The question remains if the models associated with rational \(\alpha \) are D-finite or not. Observe that they cannot be algebraic as \(\alpha \) is a negative integer [15]. Furthermore, note that the non-D-finiteness results from [7] simultaneously show that the orbits of the models are infinite. The equivalence of these two statements was proved in the case of models with small steps, yet it is conjectured to hold in greater generality. The authors provide the command evalPQ to possibly find a lower bound on the orbit size as well as the command PQList to compute the orbit elements. Now, using these commands we find that the classical tandem model (1, 1, 1) (whose generating function is of course D-finite) has a finite orbit of size 6, while for all other models from Table 2 we could not find any lower bounds on the orbit size as the evalPQ aborted after a certain threshold, which we set to 1000 and which is related to the orbit size. Thus, the orbits could be infinite or just very large. As mentioned above, a finite orbit does not directly prove D-finiteness, however, in the case of models with small steps it was proved that the model is D-finite if and only if the orbit is finite.

Let us end with some simple observations regarding the models with rational \(\alpha \). First, it is easy to see that fixing two of the three parameters \(A,B,C\) completely determines the third one. Second, for \(\gamma ^2=1/4\) it holds that \(A<B<C\) or \(C<B<A\), while for the other two cases \(\gamma ^2=1/2\) and \(\gamma ^2=3/4\) we have \(A,C< B\). Third, these families are infinite. In the first case, consider for example the parameters \(\left( A,(A-1)A,(A-1)(3A-4)\right) \) whose greatest common divisor is equal to one for odd values of \(A>1\). In the second case consider \(\left( A,(A-1)A,(A-1)(A-2)\right) \) for odd \(A>1\), and in the third case \(\left( A,(A-1)A,\frac{(A-1)(A-4)}{3}\right) \) for \(A=6k+1\) with \(k>0\).

4 Future work

We conclude this short note with some interesting questions for future research. Common to all is the need to develop general methods for the extremely useful lattice paths (with large steps) in the quarter plane and higher dimensions.

Firstly, it would be interesting to investigate the simplest model of each case in Table 2. We have not been able to do this so far, and it seems that we have reached the state-of-the-art of our current understanding of such lattice paths. Moreover, large tandem walks by themselves seem to be quite interesting and deserve a further study. E.g., what is the nature/asymptotics of Q(1, 1; t)? For classical tandem walks Q(1, 1; t) is even algebraic, while Q(0, 0, t) is D-finite transcendental [9, Proposition 9]. However, we have not been able to guess any algebraic or differential equation for Q(1, 1; t) using the first 300 terms for the other models in Table 2 and any model satisfying \(1 \le A,B,C\le 10\) with \(\gcd (A,B,C)=1\).

Secondly, it remains to consider higher dimensional d-ballot paths, generalizing Definition 1.1. The bijection of Lemma 2.2 directly generalizes and leads to excursions in \(d-1\) dimensions that are constrained to stay in the positive orthant. Zeilberger [12] experimentally considered several models in 4 dimensions and gave more conjectures for their asymptotics. However, our results rely heavily on the deep connections summarized in Theorem 2.3, and we are lacking such an understanding of higher dimensional paths at the moment. Note however that for 3-dimensional walks constrained to an octant it may be possible to use the ideas from [6], in which some results on the associated critical exponents are available.

Thirdly, classical tandem walks are in bijection with many other combinatorial models, such as Young tableaux with at most 3 rows or Motzkin paths, to name a few. Do these bijections generalize to large tandem walks, or are there similar bijections?