This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A177264 #14 May 22 2024 00:48:45 %S A177264 1,2,0,4,1,1,10,5,5,4,34,23,23,22,18,154,119,119,118,114,96,874,719, %T A177264 719,718,714,696,600,5914,5039,5039,5038,5034,5016,4920,4320,46234, %U A177264 40319,40319,40318,40314,40296,40200,39600,35280,409114,362879,362879,362878,362874,362856,362760,362160,357840,322560 %N A177264 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k as the first entry in the last block (1<=k<=n). %C A177264 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. %C A177264 Mirror image of A177263. %H A177264 G. C. Greubel, <a href="/A177264/b177264.txt">Rows n = 1..50 of the triangle, flattened</a> %H A177264 A. N. Myers, <a href="https://doi.org/10.1006/jcta.2002.3279">Counting permutations by their rigid patterns</a>, J. Combin. Theory, Series A, Vol. 99, No. 2 (2002), pp. 345-357. %F A177264 T(n, k) = (n-1)! - (k-2)! if 2 <= k <= n, otherwise T(n, 1) = 0! + 1! + ... + (n-1)! = A003422(n). %F A177264 Sum_{k=1..n} T(n, k) = A000142(n). %F A177264 T(n, k) = A177263(n, n-k+1) (mirror image). %e A177264 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). %e A177264 Triangle starts: %e A177264 1; %e A177264 2, 0; %e A177264 4, 1, 1; %e A177264 10, 5, 5, 4; %e A177264 34, 23, 23, 22, 18; %e A177264 154, 119, 119, 118, 114, 96; %e A177264 874, 719, 719, 718, 714, 696, 600; %e A177264 5914, 5039, 5039, 5038, 5034, 5016, 4920, 4320; %p A177264 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 %t A177264 A003422[n_]:= Sum[j!, {j,0,n-1}]; %t A177264 T[n_, k_]:= If[k==1, A003422[n], (n-1)! -(k-2)!]; %t A177264 Table[T[n,k], {n,12}, {k,n}]//Flatten (* _G. C. Greubel_, May 19 2024 *) %o A177264 (Magma) %o A177264 A003422:= func< n | (&+[Factorial(j): j in [0..n-1]]) >; %o A177264 A177264:= func< n,k | k eq 1 select A003422(n) else Factorial(n-1) - Factorial(k-2) >; %o A177264 [A177264(n,k): k in [1..n], n in [1..12]]; // _G. C. Greubel_, May 19 2024 %o A177264 (SageMath) %o A177264 def A003422(n): return sum(factorial(j) for j in range(n)) %o A177264 def A177264(n,k): return A003422(n) if k==1 else factorial(n-1) - factorial(k-2) %o A177264 flatten([[A177264(n,k) for k in range(1,n+1)] for n in range(1,13)]) # _G. C. Greubel_, May 19 2024 %Y A177264 Cf. A000142, A003422, A177263. %K A177264 nonn,tabl %O A177264 1,2 %A A177264 _Emeric Deutsch_, May 16 2010