OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..382
EXAMPLE
For n=2 and alphabet {a,b} we have 7 multisets: {aa}, {ab}, {ba}, {bb}, {a,a}, {a,b}, {b,b}. There is a total of 5 words beginning with the first alphabet letter, thus a(2) = 5.
MAPLE
h:= proc(n, i, k) option remember; `if`(n=0, [1, 0], `if`(i<1, 0, add(
(p-> p+[0, p[1]*j])(binomial(k^i+j-1, j)*h(n-i*j, i-1, k)), j=0..n/i)))
end:
a:= n-> `if`(n=0, 0, h(n$3)[2]/n):
seq(a(n), n=0..22);
MATHEMATICA
h[n_, i_, k_] := h[n, i, k] = If[n == 0, {1, 0}, If[i < 1, {0, 0}, Sum[ Function[p, p + {0, p[[1]]*j}][Binomial[k^i + j - 1, j]*h[n - i*j, i - 1, k]], {j, 0, n/i}]]];
a[n_] := If[n == 0, 0, h[n, n, n][[2]]/n];
Table[a[n], {n, 0, 22}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 25 2017
STATUS
approved