%I #20 Sep 01 2023 10:14:21
%S 1,1,2,4,9,20,45,92,182,342,601,982,1499,2169,2970,3994,5297,6834,
%T 8635,10714,13121,16104,19674,23868,28453,33637,39630,46730
%N Number of distinct values taken by 5th derivative of x^x^...^x (with n x's and parentheses inserted in all possible ways) at x=1.
%e a(4) = 4 because the A000108(3) = 5 possible parenthesizations of x^x^x^x lead to 4 different values of the 5th derivative at x=1: (x^(x^(x^x))) -> 360; (x^((x^x)^x)) -> 590; ((x^(x^x))^x), ((x^x)^(x^x)) -> 650; (((x^x)^x)^x) -> 1110.
%p f:= proc(n) option remember;
%p `if`(n=1, {[0, 0, 0, 0]},
%p {seq(seq(seq([2+g[1], 3*(1 +g[1] +h[1]) +g[2],
%p 8 +12*g[1] +6*h[1]*(1+g[1]) +4*(g[2]+h[2])+g[3],
%p 10+50*h[1]+10*h[2]+5*h[3]+(30+30*h[1]+10*h[2]
%p +15*g[1])*g[1]+(20+10*h[1])*g[2]+5*g[3]+g[4]],
%p h=f(n-j)), g=f(j)), j=1..n-1)})
%p end:
%p a:= n-> nops(map(x-> x[4], f(n))):
%p seq(a(n), n=1..20);
%t f[n_] := f[n] = If[n == 1, {{0, 0, 0, 0}}, Union@Flatten[#, 3]& @ {Table[ Table[Table[{2 + g[[1]], 3*(1 + g[[1]] + h[[1]]) + g[[2]], 8 + 12*g[[1]] + 6*h[[1]]*(1 + g[[1]]) + 4*(g[[2]] + h[[2]]) + g[[3]], 10 + 50*h[[1]] + 10*h[[2]] + 5*h[[3]] + (30 + 30*h[[1]] + 10*h[[2]] + 15*g[[1]])*g[[1]] + (20 + 10*h[[1]])*g[[2]] + 5*g[[3]] + g[[4]]}, {h, f[n - j]}], {g, f[j]}], {j, 1, n - 1}]}];
%t a[n_] := Length@Union@(#[[4]]& /@ f[n]);
%t Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 24}] (* _Jean-François Alcover_, Sep 01 2023, after _Alois P. Heinz_ *)
%Y Cf. A000081 (distinct functions), A000108 (parenthesizations), A000012 (first derivatives), A028310 (2nd derivatives), A199085 (3rd derivatives), A199205 (4th derivatives), A002845, A003018, A003019, A145545, A145546, A145547, A145548, A145549, A145550, A082499, A196244, A198683, A215703, A215835. Column k=5 of A216368.
%K nonn
%O 1,3
%A _Alois P. Heinz_, Nov 04 2011