OFFSET
1,2
COMMENTS
A block of a permutation is a maximal sequence of consecutive integers which appear in consecutive positions. For example, the permutation 45123867 has 4 blocks: 45, 123, 8, and 67.
Mirror image of A177263.
LINKS
G. C. Greubel, Rows n = 1..50 of the triangle, flattened
A. N. Myers, Counting permutations by their rigid patterns, J. Combin. Theory, Series A, Vol. 99, No. 2 (2002), pp. 345-357.
FORMULA
EXAMPLE
T(4,3)=5 because we have 12-4-3, 2-1-34, 2-1-4-3, 2-4-1-3, and 4-2-1-3 (the blocks are separated by dashes).
Triangle starts:
1;
2, 0;
4, 1, 1;
10, 5, 5, 4;
34, 23, 23, 22, 18;
154, 119, 119, 118, 114, 96;
874, 719, 719, 718, 714, 696, 600;
5914, 5039, 5039, 5038, 5034, 5016, 4920, 4320;
MAPLE
T := proc (n, k) if 2 <= k and k <= n then factorial(n-1)-factorial(k-2) elif k = 1 then sum(factorial(j), j = 0 .. n-1) else 0 end if end proc: for n to 10 do seq(T(n, k), k = 1 .. n) end do; # yields sequence in triangular form
MATHEMATICA
A003422[n_]:= Sum[j!, {j, 0, n-1}];
T[n_, k_]:= If[k==1, A003422[n], (n-1)! -(k-2)!];
Table[T[n, k], {n, 12}, {k, n}]//Flatten (* G. C. Greubel, May 19 2024 *)
PROG
(Magma)
A003422:= func< n | (&+[Factorial(j): j in [0..n-1]]) >;
[A177264(n, k): k in [1..n], n in [1..12]]; // G. C. Greubel, May 19 2024
(SageMath)
def A003422(n): return sum(factorial(j) for j in range(n))
flatten([[A177264(n, k) for k in range(1, n+1)] for n in range(1, 13)]) # G. C. Greubel, May 19 2024
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Emeric Deutsch, May 16 2010
STATUS
approved