The Ramanujan sequence is the sequence defined by
and, for
,
|
(1)
|
Ramanujan (1911) introduced this correction in comparing with the partial sum of
the power series for the exponential
function through
.
Multiplying the difference by
expresses it in units of the next term
. Equivalently, for
, if
has a Poisson distribution
with mean
, then
|
(2)
|
Thus
measures the upper-tail excess over one half in units of the probability
at the mean, a connection used to study statistical
medians of Poisson distributions and
gamma distributions (Alm 2003).
More precisely, let
denote the statistical median of a unit-scale
gamma distribution with shape
. For
, Choi (1994) proved the exact identity
|
(3)
|
The first few terms are
|
(4)
| |||
|
(5)
| |||
|
(6)
| |||
|
(7)
| |||
|
(8)
|
It is a decreasing sequence with limit and satisfies
for
(Adell and Jodrá 2008, Bakan et al. 2016).
As ,
it has the divergent asymptotic expansion
|
(9)
|
The coefficients can be computed directly from
|
(10)
|
where
denotes the coefficient of
in
(O'Sullivan 2023). Their exponential
generating function can be written implicitly as
|
(11)
| |||
|
(12)
|
where
is the formal power series in
specified by the second equation and
. The numerators
of the displayed coefficients are 1, 4,
,
, ... (OEIS A260306),
and their denominators are 3, 135, 2835, 8505, ...
(OEIS A065973).
Knuth's Ramanujan -function
is
|
(13)
| |||
|
(14)
|
If ,
the exponential generating function
of the weighted sequence
is
|
(15)
|
The function arose in Knuth's analysis of hashing with linear probing and also occurs in the birthday problem, random mapping statistics and Pollard's rho method for prime factorization, union-find algorithms under the random spanning tree model, optimum caching, and memory-conflict problems (Knuth 1985, Flajolet et al. 1995).