%I #20 Jun 27 2016 17:41:12
%S 1,1,4,21,142,1175,11476,129073,1641802,23292459,364530688,6237123365,
%T 115806988342,2318774566303,49799220552940,1141845310143897,
%U 27838573420105762,719091858410591507,19617132273844278232,563588641924040326669,17007875120002223426062
%N a(n) = number of sequences (a_1, a_2, ..., a_n) in {1,2,...,n} such that the range {a_1, a_2, ..., a_n} is an interval.
%C a(n) = (n+1)*A(n) - (A(n+1)-A(n))/2, where A is sequence A000670.
%C Number of ways to put n objects in n boxes such that the nonempty boxes are contiguous. - _Olivier GĂ©rard_, Jun 15 2012
%H Alois P. Heinz, <a href="/A120368/b120368.txt">Table of n, a(n) for n = 0..200</a>
%F E.g.f.: (3-2*exp(x)+x*exp(x))/(exp(x)-2)^2.
%F a(0) = 1, a(n) = Sum_{k=1..n} (n-k+1)*k!*Stirling2(n,k) for n>0.
%F a(n) ~ n!*n*(2*log(2)-1)/(4*(log(2))^(n+2)). - _Vaclav Kotesovec_, Dec 08 2012
%e The range of (2,5,5,3,4) is the interval {2,3,4,5}, the range of (2,5,5,3,2) is {2,3,5}, not an interval since 4 is missing.
%e a(3) = 21 because the only 3-sequences in {1,2,3} (from a total of 3^3=27) whose range is not an interval are (1,1,3), (1,3,1), (1,3,3), (3,1,1), (3,1,3) and (3,3,1).
%p a:= n-> `if`(n=0, 1, add((n-k+1)*k!*Stirling2(n, k), k=1..n)):
%p seq(a(n), n=0..30); # _Alois P. Heinz_, Dec 05 2012
%t Flatten[{1,Table[Sum[(n-k+1)*k!*StirlingS2[n,k],{k,1,n}],{n,1,20}]}] (* or *) CoefficientList[Series[(3-2*E^x+x*E^x)/(E^x-2)^2, {x, 0, 20}], x]* Range[0, 20]! (* _Vaclav Kotesovec_, Dec 08 2012 *)
%K easy,nonn
%O 0,3
%A Jose Luis Arregui (arregui(AT)unizar.es), Jun 26 2006