%I #32 Sep 27 2017 09:31:08
%S 1,8,57,424,3425,30336,294553,3123632,36003969,448816600,6022033721,
%T 86587079448,1328753602657,21683227579664,375013198304025,
%U 6853321766162656,131976208783240193,2671430511854158632,56709161712552286009,1259836187316759240200
%N Number of sequences of balls colored with at most n colors such that exactly one ball is of a color seen earlier in the sequence.
%C Note that any such sequence has at least 2 balls, and at most n+1
%C Number of sequences of balls colored with at most n colors such that exactly two balls are the same color as some other ball in the sequence (necessarily each other). - _Jeremy Dover_, Sep 26 2017
%H Jeremy Dover, <a href="/A281912/b281912.txt">Table of n, a(n) for n = 1..99</a>
%F a(n) = n! * Sum_{k=2..n+1} binomial(k,2)/(n+1-k)!.
%F a(n) = n if n < 2, a(n) = n*((n+2)/(n-1)*a(n-1) - a(n-2)) for n >= 2. - _Alois P. Heinz_, Feb 02 2017
%F a(n)/n! ~ e*n^2/2. - _Vaclav Kotesovec_, Feb 03 2017
%e n=1 => AA -> a(1) = 1.
%e n=2 => AA,BB,AAB,ABA,BAA,BBA,BAB,ABB -> a(2) = 8.
%p a:= proc(n) option remember;
%p `if`(n<2, 1, a(n-1)*(n+2)/(n-1)-a(n-2))*n
%p end:
%p seq(a(n), n=1..25); # _Alois P. Heinz_, Feb 02 2017
%t Table[n!*Sum[Binomial[k, 2]/(n + 1 - k)!, {k, 2, n + 1}], {n, 20}] (* _Michael De Vlieger_, Feb 02 2017 *)
%Y Cf. A093964.
%Y Row sums of triangle A281881. - _Jeremy Dover_, Sep 26 2017
%K nonn
%O 1,2
%A _Jeremy Dover_, Feb 01 2017