Abstract
In Ekhad and Zeilberger (Personal J Shalosh B Ekhad and Doron Zeilberger, 2020) an exciting case study has been initiated in which experimental mathematics and symbolic computation are utilized to discover new properties concerning the so-called Absent-Minded Passengers Problem. Based on these results, Doron Zeilberger raised some challenging tasks to gain further probabilistic insight. In this note we report on this enterprise. In particular, we demonstrate how the computer algebra packages of RISC can be used to carry out the underlying heavy calculations.
1 A Challenging Email
On January 22, 2020 I received the following email by Doron Zeilberger:

When I received this email, I was thrilled: First, if one gets such an email – in particular from Doron Zeilberger, one is automatically eager to solve it. And second, I highly appreciate “The On-Line Encyclopedia of Integer Sequences” (OEIS) at http://www.oeis.org and supporting it by a donation of Doron Zeilberger gave an extra strong motivation.
Summarizing, the above email provoked various heavy calculations by means of computer algebra that will be described in the following.
2 The Underlying Problem and Symbolic Summation
The combinatorial problem of absent-minded passengers can be introduced as follows.
Definition 2.1
Consider a plane with \(n\ge 2\) seats and suppose that n passengers enter the plane step-wise taking their seats. In addition, suppose that the first \(k\ge 1\) passengers are absent-minded, i.e., they lost their seat ticket and take a seat uniformly at random. The remaining \(n-k\) not absent-minded (but shy) passengers take their dedicated seats (as given in the plane ticket) if it is still free; otherwise, they choose uniformly at random one of the still available free seats. For \(0\le r\le n\), let \(p_{n,k,r}\) be the probability that exactly r passengers sit in the wrong seat and let \(X_n\) be the random variable for “the number of passengers sitting in the wrong seat”. Then the expected value for the passengers sitting in the wrong seat is
and its variance is
The situation of one absent-minded passenger (\(k=1\)) has been considered in [5, 16] and has been explored further in [7] for the general case \(k\ge 1\). Among other fascinating results, closed forms for \(E(X_n)\) and \(V(X_n)\) have been obtained in [7] by skillful combinatorial arguments. More precisely, the definite sum representations
and
have been derived and simplified to
and
in terms of the harmonic numbers
of order \(o\ge 1\) (often they are also denoted by \(H^{(o)}_n=S_o(n)\) with the special case \(H_n=S_1(n)\)). In the following we will prefer to write such expressions in terms of the modified harmonic numbers
yielding, e.g., the more compact expressions
and
While the simplification from (2.1) to (2.3) is straightforward, more work has to be carried out to derive (2.4) from (2.2). In [7] further details are suppressed how these simplifications have been obtained. Here I want to point out that such (usually painful) classical manipulations are meanwhile obsolete. For instance, by loading in the computer algebra packages

into Mathematica the multi-sum expression for the variance

can be simplified to a closed form within seconds by executing the commandFootnote 1

Remark
Internally, the command EvaluateMultiSums of the package EvaluateMultiSums.m [13] uses the summation paradigms of telescoping, creative telescoping and recurrence solving of the summation package Sigma.m [11]; the underlying algorithms generalize the hypergeometric case [9] to the class of indefinite nested sums and products in the setting of difference fields and rings [8, 14, 15]. In addition, the calculations are supported by special function algorithms of the package HarmonicSums.m [2, 3]. We note that the user is completely freed from applying the summation tools explicitly. However, all the calculation steps are equipped with proof certificates (based on the creative telescoping paradigm introduced in [17]). Thus if necessary, a rigorous correctness proof can be extracted.
3 The Generating Function Approach for Large Moments
As elaborated in detail in [6] the expectation, the variance and higher moments can be elegantly described with the generating function approach. Namely, consider the generating function
of the probability \(p_{n,k,r}\) introduced in Definition 2.1. Then the expectation and variance (see also Definition 2.1) can be straightforwardly connected to the generating function via
and
More generally, define
and
for \(l\ge 1\); note that \(M_1(n,k)=E(X_n)\). Then one can define the l-th moment by
In the above email but also in [6] the task was assigned to compute (besides the known moments \(m_1(n,k)=0\) and \(m_2(n,k)=V(X_n)\)) further moments \(m_l(n,k)\) (at least for \(l=3,4\)).
The combinatorial approach of [7] to derive multi-sum expressions of \(m_l(n,k)\) for larger l seems hopeless. Even though it would have been pure fun to challenge Sigma.m, similarly as in in [10], with more complicated sums than (2.3). Another exciting approach has been carried out in [6, Theorem 5] by guessing the moments \(m_l(n,k)\) for the special case \(k=1\) and \(l=2,\dots ,8\). As it turns out (and proposed by Doron Zeilberger in his email), this attempt can be pushed forward by the following powerful formula given in [6, Theorem 3]:
here \((x)_k=x(x+1)\dots (x+k-1)\) denotes the Pochhammer symbol. As a consequence, one can calculate straightforwardly any value of \(M_l(n,k)\) and thus of \(m_l(n,k)\) for particularly chosen n and k. E.g., we can compute

and activating the formula (3.2) for \(n=10\), \(k=2\) and \(l=3\) yields the third moment

But even more is possible with the hypergeometric sum representation (3.3). As already proposed in [6] one can derive easily the closed-form expressions of \(M_l(n,k)\) for symbolic n and k. For this task we observe that
i.e., for any \(l\in {\mathbb Z}_{\ge 0}\) at most \(l+1\) summands contribute and the remaining summands vanish with the evaluation \(w=1\). Moreover the differentiation of the arising building blocks in (3.4) can be carried out easily. For instance if we differentiate \((2+r\,w)_{n-k-1}\) twice w.r.t. w by using the Mathematica-command D and the Sigma-commands ToSigma and CollectProdSum we get

In this way, one can compute \(M_1(n,k)(=E(X_n))\) and rediscovers (2.5). Similarly, one gets, e.g.,
and
with
Note that in \(M_3(n,k)\) the factor \(\frac{3 (k-2) k (n-k)}{(n-1)^2 n}\) does not contribute for \(k=1,2\) (\(k=2\) would vanish anyway); this comes from the fact that in the summation of (3.4) the lower bound \(k-l\) with \(l=3\) should be non-negative.
In a nutshell, one can calculate sufficiently many \(M_l(n,k)\) and using the formula (3.2) one gets the desired moments \(m_l(n,k)\). With \(M_1(n,k)=E(X_n)\) given in (2.5), (3.5) and (3.6) one can reproduce \(m_2(n,k)\) as given in (2.6) and can compute in addition
Similarly, one obtains, e.g.,
For instance, specializing \(m_4(n,k)\) to \(k=1\) gives
for one absent-minded passenger (as derived in [6, Theorem 5]) and
for two absent-minded passengers.
Following this strategy we succeeded in computing the moments \(m_l(n,k)\) up to \(l=15\) on a machine with 12 cores and 1.5TB memory, but failed to proceed due to time and space limitations. Luckily, another great trick from [18] enabled us to compute even more moments. Namely, the calculation of
turns out to be much faster (and less memory consuming) than the calculation of (3.4). Given these so-called exponential moments, one gets back the ordinary moments \(M_l(n,k)\) by using the following formula from [18]:
where S(l, r) denotes the Stirling numbers of the second kind. In summary, we carried out the following steps:
-
Step 1:
Calculate the exponential moments \({\bar{M}}_l(n,k)\) with the formula (3.7).
-
Step 2:
Calculate the ordinary moments \(M_l(n,k)\) with the formula (3.8).
-
Step 3:
Finally, calculate the desired moments \(m_l(n,k)\) with the formula (3.2).
Using this approach, we succeeded in calculating generouslyFootnote 2 the moments \(m_l(n,k)\) up to \(l=21\) in a decent amount of time and memory. The moments up to order 16 are available online at
https://www.risc.jku.at/people/cschneid/data/AMPassenger.tar.gz.
Furthermore, a Mathematica notebook is provided at
https://www.risc.jku.at/people/cschneid/data/AMPassenger.nb
that illustrates the main calculations (e.g., up to \(l=7\)). For higher moments the calculations have been distributed (parallelized) neatly using about 10 Mathematica subkernels. Since the code is rather technical and not easily digestible, it is suppressed within the attached Mathematica notebook. The corresponding timings for the various steps, the total time and the size of the moments are summarized in the Table 1).
We note that for \(l\in {\mathbb Z}_{\ge 0}\) a closed-form expression for \(m_l(n,k)\) can be given in terms of the harmonic numbers \(S_r(n)\) and \(S_r(k)\) (resp. \({\bar{S}}_r(n)\) and \({\bar{S}}_r(k)\)) with \(1\le r\le l\). We note further that the sequences generated by the harmonic numbers \(\{S_r(n)\mid r\ge 1\}\) (resp. \(\{{\bar{S}}_r(n)\mid r\ge 1\}\)) are algebraically independent among the rational sequences, i.e., the representation of \(m_l(n,k)\) in terms of the harmonic numbers is optimal. Interestingly enough, the algebraic independence can be shown with the help of the summation paradigm of parameterized (creative) telescoping; see [12, Example 6.3]. For more general classes of harmonic sums we refer also to [4].
4 Asymptotic Expansions
Two days after Doron Zeilberger’s first email, I got a slight update of his challenge:


Given the calculations of \(m_l(n,k)\) we proceed as follows. For \(l=2\) we enter the computed closed-form expression

and use the HarmonicSums command to calculate the first terms of the expansion in n:

where \(\gamma \approx 0.577216\) is Euler’s constant, \(S[2,\infty ]=S_2(\infty )=\zeta (2)=\frac{\pi ^2}{6}\), and \(\zeta (z)=\sum _{i=1}^{\infty }\frac{1}{i^z}\) denotes the Riemann-Zeta function. Summarizing, we have calculated
Analogously, we obtain, e.g., the expansion of \(m_3(n,k)\):
In total we calculated these expansions of \(m_l(n,k)\) up to \(l\le 18\) with the following timings
l | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
time | 1.2s | 3.6s | 9.6s | 25 | 65s | 167s | 405s | 986s | 2419s | 1.6h | 3.8h | 9.8h | 22.7h | 53.4h. |
Here we parallelized the calculations on 10 Mathematica kernels. E.g., we needed 53.4 hours to obtain the expansion for \(m_{18}(n,k)\); however summing up all the timings of the used kernels we needed in total 16 days of CPU time to tackle the case \(l=18\). The expansions up to order 16 are available online and the corresponding link can be found on page 8.
To fully win Doron Zeilberger’s challenge, we also dealt with the limit
Looking at (4.1) the leading term in the expansion of \(m_2(n,k)\) equals \(\log (n)\,k\). In addition the leading term in \(m_3(n,k)\) is also \(\log (n)\,k\). Thus
Similarly, given the other computed expansions we get
and
l | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 |
---|---|---|---|---|---|---|---|---|---|
\(c_l(k)\) | 1 | 3 | 15 | 105 | 945 | 10395 | 135135 | 2027025 | 34459425. |
As a consequence we can confirm that the first values \(c_{2l}(k)\) agree with the double factorial of odd numbers (sequence A001147 in OEIS), i.e.,
holds for all \(1\le l\le 9\).
5 Conclusion
When I received Doron Zeilberger’s email, the first calculations were straightforward – except that I was not (and I am still not) expert in probability theory and thus made some annoying errors in the beginning. However, pushing the calculations further to the \(21^{st}\) moment and computing its asymptotic expansions was a challenge. Here the computer algebra packages developed at RISC (Sigma.m and EvaluateMultiSums.m by myself and HarmonicSums.m by Jakob Ablinger) were of great help to calculate these huge expressions. I hope that this little note advertises how existing computer algebra tools in general and in particular those of the combinatorics group at RISC can push forward interesting (combinatorial) research topics. For instance, these packages have been heavily used in the last years to carry out large-scale QCD-calculations in the research field of elementary particle physics; see, e.g., [1] and references therein. Last but not least, I am very grateful to Doron Zeilberger who challenged me with these problems and initiated this fun project.
Notes
Within the Sigma package (and later the HarmonicSums package) \(S_o(n)\) is denoted by \(\texttt {S[o,n]}\).
Originally only \(l\le 4\) was required in the challenge.
References
Ablinger, J., Behring, A., Blümlein, J., De Freitas, A., von Manteuffel, A., Schneider, C.: Calculating three loop ladder and V-topologies for massive operator matrix elements by computer algebra. Comput. Phys. Commun. 202, 33–112 (2016). arXiv:1509.08324 [hep-ph]
Ablinger, J., Blümlein, J., Schneider, C.: Harmonic sums and polylogarithms generated by cyclotomic polynomials. J. Math. Phys. 52(10), 1–52 (2011). [arXiv:1007.0375 [hep-ph]]
Ablinger, J., Blümlein, J., Schneider, C.: Analytic and algorithmic aspects of generalized harmonic sums and polylogarithms. J. Math. Phys. 54(8), 1–74 (2013). arXiv:1302.0378 [math-ph]
Ablinger, J., Schneider, C.: Algebraic independence of sequences generated by (cyclotomic) harmonic sums. Ann. Combin. 22(2), 213–244 (2018). arXiv:1510.03692 [cs.SC]
Bollobás, B.: The Art of Mathematics: Coffee Time in Memphis. Cambridge University Press, Cambridge (2006)
Ekhad, S.B., Zeilberger, D.: The absent-minded passengers problem via computer algebra. The Personal Journal of Shalosh B. Ekhad and Doron Zeilberger, (2020) arXiv:2001.06839 [math.CO]
Henze, N., Last, G.: Absent-minded passengers. Am. Math. Monthly 126(10), 867–875 (2019). arXiv:1809.10192 [math.PR]
Karr, M.: Summation in finite terms. J. ACM 28, 305–350 (1981)
Petkovšek, M., Wilf, H.S., Zeilberger, D.: \(A=B\). A K Peters, Wellesley (1996)
Prodinger, H., Schneider, C., Wagner, S.: Unfair permutations. Europ. J. Comb. 32, 1282–1298 (2011)
Schneider, C.: Symbolic summation assists combinatorics. Sém. Lothar. Combin., 56:1–36, (2007) Article B56b
Schneider, C.: Parameterized telescoping proves algebraic independence of sums. Ann. Comb., 14:533–552, (2010). [arXiv:0808.2596]; for a preliminary version see FPSAC 2007
Schneider, C.: Simplifying multiple sums in difference fields. In C. Schneider and J. Blümlein, editors, Computer Algebra in Quantum Field Theory: Integration, Summation and Special Functions, Texts and Monographs in Symbolic Computation, pp. 325–360. Springer, (2013). arXiv:1304.4134 [cs.SC]
Schneider, C.: A difference ring theory for symbolic summation. J. Symb. Comput. 72, 82–127 (2016). arXiv:1408.2776 [cs.SC]
Schneider, C.: Summation Theory II: Characterizations of \(R\Pi \Sigma \)-extensions and algorithmic aspects. J. Symb. Comput 80(3), 616–664 (2017). arXiv:1603.04285 [cs.SC]
Winkler, P.: Mathematical Puzzles: A Connoisseur’s Collection. A K Peters, (2004)
Zeilberger, D.: The method of creative telescoping. J. Symbolic Comput. 11, 195–204 (1991)
Zeilberger, D.: The automatic central limit theorems generator (and much more!). In Advances in combinatorial mathematics, pp. 165–174. Springer, Berlin, (2009)
Acknowledgements
Open access funding provided by Johannes Kepler University Linz. I would like to thank the two referees for their valuable suggestions to improve the presentation.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supported by the Austrian Science Fund (FWF) grant SFB F50 (F5009-N15)
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Schneider, C. The Absent-Minded Passengers Problem: A Motivating Challenge Solved by Computer Algebra. Math.Comput.Sci. 15, 577–588 (2021). https://doi.org/10.1007/s11786-020-00494-w
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11786-020-00494-w