Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #14 Mar 19 2022 06:37:22
%S 1,1,3,20,231,3864,85360,2353546,77963599,3019479344,133966276692,
%T 6702399275538,373406941221160,22930441709648290,1539004344848618466,
%U 112089683771614695478,8805334896381292460191,742162775145283382779168,66809386370870410069346476
%N Number of words of semilength n over n-ary alphabet, either empty or beginning with the first letter of the alphabet, such that the index set of occurring letters is an integer interval [1, k], that can be built by repeatedly inserting doublets into the initially empty word.
%H Alois P. Heinz, <a href="/A294603/b294603.txt">Table of n, a(n) for n = 0..350</a>
%F a(n) = Sum_{k=0..n} A256116(n,k).
%e a(0) = 1: the empty word.
%e a(1) = 1: aa.
%e a(2) = 3: aaaa, aabb, abba.
%e a(3) = 20: aaaaaa, aaaabb, aaabba, aabaab, aabbaa, aabbbb, aabbcc, aabccb, aacbbc, aaccbb, abaaba, abbaaa, abbabb, abbacc, abbbba, abbcca, abccba, acbbca, accabb, accbba.
%p A:= proc(n, k) option remember; `if`(n=0, 1, k/n*
%p add(binomial(2*n, j) *(n-j) *(k-1)^j, j=0..n-1))
%p end:
%p T:= proc(n, k) option remember;
%p add(A(n, k-i)*(-1)^i*binomial(k, i), i=0..k)/`if`(k=0, 1, k)
%p end:
%p a:= n-> add(T(n, k), k=0..n):
%p seq(a(n), n=0..20);
%t A[n_, k_] := A[n, k] = If[n == 0, 1, k/n*
%t Sum[Binomial[2*n, j]*(n-j) *If[j == 0, 1, (k - 1)^j], {j, 0, n - 1}]];
%t T[n_, k_] := T[n, k] =
%t Sum[A[n, k - i]*(-1)^i*Binomial[k, i], {i, 0, k}]/If[k == 0, 1, k];
%t a[n_] := Sum[T[n, k], {k, 0, n}];
%t Table[a[n], {n, 0, 20}] (* _Jean-François Alcover_, Mar 19 2022, after _Alois P. Heinz_ *)
%Y Row sums of A256116.
%Y Cf. A258498.
%K nonn
%O 0,3
%A _Alois P. Heinz_, Nov 03 2017