|
|
A120368
|
|
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.
|
|
2
|
|
|
1, 1, 4, 21, 142, 1175, 11476, 129073, 1641802, 23292459, 364530688, 6237123365, 115806988342, 2318774566303, 49799220552940, 1141845310143897, 27838573420105762, 719091858410591507, 19617132273844278232, 563588641924040326669, 17007875120002223426062
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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.
|
|
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)):
|
|
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
|
|
|
|