OFFSET
0,4
COMMENTS
T(n,k)/n^n is the expected value of C(F_n,k), where the random variable F_n is the number of rolls of a fair n-sided die before the first repeated face.
Consider an endofunction as a digraph (comprised of a set of cycles, with each cyclic element being the root of a tree of non-cyclic preimages), then T(n,k) is the number of endofunctions [n]->[n] with k trees painted blue and the rest painted red.
LINKS
Philippe Flajolet, Peter J. Grabner, Peter Kirschenhofer, and Helmut Prodinger, On Ramanujan's Q-function, Journal of Computational and Applied Mathematics, vol. 58, iss. 1 (1995-03-20), pp. 103-116.
Natalia L. Skirrow, decomposing the binomial moments of (# distinct faces seen rolling n-sided die before first repetition), Mathematics StackExchange, 2026.
Natalia L. Skirrow, Euler's tree function.
Wikipedia, Lambert W function.
FORMULA
T(n,k) = Sum_{j=k..n} A066324(n,j) * C(j,k).
E.g.f.: 1/(1-(1+y)*T(x)) where T(x) satisfies T=x*e^T. (T(x) is A000169's e.g.f. and equals -W(-x) where W is the Lambert W).
E.g.f. is F(x,1+y), where F(x,y) is A066324's e.g.f.
E.g.f. for T(n,k)/n (for n>0): T + (1-1/(1+y))*log(1/(1-(1+y)*T)).
E.g.f. for T(n,k)/n is G(x,1+y), where G(x,y) = T+(1-1/y)*C(x,y) is A259334's e.g.f. and C(x,y)=log(1/(1-y*T)) is A201685's.
For row o.g.f., replace y with 1+y in that of A066324.
Let Q(n) = Sum_{k=1..n} n!/((n-k)!*n^k) ~ sqrt(Pi*n/2) be Ramanujan's Q function.
T(n,k) = n^(n-k) * hypergeometric([k-n,k],[],-1/n) * n!/(n-k)!.
T(n,k) = A394824(n,k)*n!/(n-k)!. - Peter Luschny, Apr 04 2026
T(n,3) = n^n*((n+2)*Q(n) - 3*n)/2.
In general, T(n,k)/n^n = A_k(n)*Q(n) + B_k(n), with A_k,B_k polynomials of degree ceiling(k/2)-1 and floor(k/2), with:
A_k(n) = Sum_{j=0..k-1}(-n)^j/j! * C(n-1-j,k-1-j).
B_k(n) = n*Sum_{j=0..m-2}(-n)^j/j! * Sum_{k=0..m-2-j} C(n-1,k)*C(m-2-k,j)*(-1)^(m-j-k)/(j+k+1).
Both A_k and B_k abide by the recurrence k*P_{k+1}(n) = (1-2*k)*P_k(n) + (n+1-k)*P_{k-1}(n).
From Peter Luschny, Apr 09 2026: (Start)
T(n, k) = ((2*k + 1)*T(n, k+1) + (k + 1)*T(n, k+2))/(n - k) with T(n, n) = n!.
Let egf(x, y) = exp(x * (1 + y) * exp(y / (1 + y))) / (1 + y), then
T(n, k) = (n!)^2 * [x^n y^(n-k)] egf(x, y). (End)
EXAMPLE
Triangle begins:
n\k 0 1 2 3 4 5 6 7
-+--------------------------------------------------------
0| 1
1| 1 1
2| 4 6 2
3| 27 51 30 6
4| 256 568 456 168 24
5| 3125 7845 7780 4020 1080 120
6| 46656 129456 150480 97920 37440 7920 720
7|823543 2485567 3279234 2537850 1235640 375480 65520 5040
MAPLE
seq(print(seq(simplify(A394852(n, k)), k = 0..n)), n = 0..9); # Peter Luschny, Apr 04 2026
# Alternative:
egf := (1 + (y + 1) * LambertW(-x))^(-1): ser := series(egf, x, 9): xcoeff := n -> coeff(ser, x, n): seq(print(seq(n! * coeff(xcoeff(n), y, k), k = 0..n)), n = 0..7); # Peter Luschny, Apr 06 2026
MATHEMATICA
nMax = 8; egf = Exp[x*(1 + y)*Exp[y/(1 + y)]] / (1 + y);
coeffs = Series[egf, {x, 0, nMax+1}, {y, 0, nMax+1}] // Normal;
Table[(n!)^2 * Coefficient[Coefficient[coeffs, x, n], y, n - k], {n, 0, nMax}, {k, 0, n}] // Flatten (* Peter Luschny, Apr 09 2026 *)
PROG
(Python)
from math import factorial
def A394852row(n: int) -> list[int]:
if n == 0: return [1]
row = [0] * (n + 1)
row[n] = curr = factorial(n)
ahead = 0
for k in range(n, 0, -1):
prev = ((2 * k - 1) * curr + k * ahead) // (n - k + 1)
row[k - 1] = prev
ahead, curr = curr, prev
return row
for n in range(0, 8): print(A394852row(n)) # Peter Luschny, Apr 09 2026
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Natalia L. Skirrow, Apr 04 2026
STATUS
approved
