OFFSET
0,3
COMMENTS
a(n) = (n+1)*A(n) - (A(n+1)-A(n))/2, where A is sequence A000670.
Number of ways to put n objects in n boxes such that the nonempty boxes are contiguous. - Olivier GĂ©rard, Jun 15 2012
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..200
FORMULA
E.g.f.: (3-2*exp(x)+x*exp(x))/(exp(x)-2)^2.
a(0) = 1, a(n) = Sum_{k=1..n} (n-k+1)*k!*Stirling2(n,k) for n>0.
a(n) ~ n!*n*(2*log(2)-1)/(4*(log(2))^(n+2)). - Vaclav Kotesovec, Dec 08 2012
EXAMPLE
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.
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).
MAPLE
a:= n-> `if`(n=0, 1, add((n-k+1)*k!*Stirling2(n, k), k=1..n)):
seq(a(n), n=0..30); # Alois P. Heinz, Dec 05 2012
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Jose Luis Arregui (arregui(AT)unizar.es), Jun 26 2006
STATUS
approved