A097900 Number of runs of length 1 in all permutations of [n]. (The permutation 3574162 has two runs of length 1: 357/4/16/2.)
1, 2, 7, 32, 180, 1200, 9240, 80640, 786240, 8467200, 99792000, 1277337600, 17643225600, 261534873600, 4140968832000, 69742632960000, 1244905998336000, 23475370254336000, 466306218233856000, 9731608032706560000
Offset: 1
Examples
a(3) = 7 because there are 7 runs of length 1 in the permutations 123, 13(2), (2)13, 23(1), (3)12, (3)(2)(1) (shown between parentheses).
Links
- G. C. Greubel, Table of n, a(n) for n = 1..445
- Alice L.L. Gao, Emily X.L. Gao, Patxi Laborde-Zubieta, and Brian Y. Sun, Enumeration of Corners in Tree-like Tableaux, arXiv:1511.05456 [math.CO], 2016.
- Ira M. Gessel, Generating functions and enumeration of sequences, Ph. D. Thesis, MIT, 1977.
Crossrefs
Cf. A159920.
Programs
-
Magma
[1] cat [Factorial(n)*(n+4)/6: n in [2..25]]; // Vincenzo Librandi, Nov 18 2015
-
Maple
seq(ceil(n!*(n+4)/6),n=1..23);
-
Mathematica
Join[{1}, Table[n! (n + 4)/6, {n, 2, 20}]] (* Vincenzo Librandi, Nov 18 2015 *) Rest[With[{nmax = 50}, CoefficientList[Series[x*(6 - 6*x + x^2)/(6*(1 - x)^2), {x, 0, nmax}], x]*Range[0, nmax]!]] (* G. C. Greubel, Dec 20 2017 *)
-
PARI
my(x='x+O('x^30)); Vec(serlaplace(x*(6-6*x+x^2)/(6*(1-x)^2))) \\ G. C. Greubel, Dec 20 2017
-
PARI
a(n) = if(n==1, 1, n!*(n+4)/6); \\ Altug Alkan, Dec 21 2017
Formula
a(n) = n!*(n+4)/6 for n >= 2.
E.g.f.: x*(6-6*x+x^2)/(6*(1-x)^2).
a(n) = (A159920(n)*(n-2)!)/ 2 for n >= 2. - Cullen M. Vaney, Jul 14 2025
Comments