%I #17 Oct 03 2024 15:13:45
%S 1,1,4,27,256,3125,46656,823543,16777208,387419832,9999962640,
%T 285309793890,8916009869448,302870744070180,11111793078586200,
%U 437883125030581230,18446183535139520160,827209994815650320160,39344710668752223656064,1978320731100920186439888
%N a(n) is the number of endofunctions on a set of size n with preimage constraint {0, 1, 2, 3, 4, 5, 6, 7}.
%C A preimage constraint is a set of nonnegative integers such that the size of the inverse image of any element is one of the values in that set.
%C Thus, the n-th term of the sequence is the number of endofunctions on a set of size n such that each preimage has at most 7 elements. Equivalently, it is the number of n-letter words from an n-letter alphabet such that no letter appears more than 7 times.
%H Benjamin Otto, <a href="https://arxiv.org/abs/1903.00542">Coalescence under Preimage Constraints</a>, arXiv:1903.00542 [math.CO], 2019, Corollaries 5.6 and 7.8.
%F a(n) = n! * [x^n] e_7(x)^n, where e_k(x) is the truncated exponential 1 + x+ x^2/2! + ... + x^k/k!. The link above yields explicit constants c_k, r_k so that the columns are asymptotically c_7 * n^(-1/2) * r_7^-n.
%p b:= proc(n, i) option remember; `if`(n=0 and i=0, 1, `if`(i<1, 0,
%p add(b(n-j, i-1)*binomial(n, j), j=0..min(7, n))))
%p end:
%p a:= n-> b(n$2):
%p seq(a(n), n=0..20); # _Alois P. Heinz_, Apr 05 2019
%t b[n_, i_] := b[n, i] = If[n == 0 && i == 0, 1, If[i<1, 0, Sum[b[n-j, i-1]* Binomial[n, j], {j, 0, Min[7, n]}]]];
%t a[n_] := b[n, n];
%t a /@ Range[0, 20] (* _Jean-François Alcover_, Feb 29 2020, after _Alois P. Heinz_ *)
%o (Python)
%o # print first num_entries entries in the sequence
%o import math, sympy; x=sympy.symbols('x')
%o k=7; num_entries = 64
%o P=range(k+1); eP=sum([x**d/math.factorial(d) for d in P]); r = [1]; curr_pow = 1
%o for term in range(1,num_entries):
%o curr_pow=(curr_pow*eP).expand()
%o r.append(curr_pow.coeff(x**term)*math.factorial(term))
%o print(r)
%Y Column k=7 of A306800; see that entry for sequences related to other preimage constraints constructions.
%K easy,nonn
%O 0,3
%A _Benjamin Otto_, Mar 25 2019