cp's OEIS Frontend

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.

A177262 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} starting with exactly k consecutive integers (1<=k<=n).

This page as a plain text file.
%I A177262 #8 May 21 2024 10:18:25
%S A177262 1,1,1,4,1,1,18,4,1,1,96,18,4,1,1,600,96,18,4,1,1,4320,600,96,18,4,1,
%T A177262 1,35280,4320,600,96,18,4,1,1,322560,35280,4320,600,96,18,4,1,1,
%U A177262 3265920,322560,35280,4320,600,96,18,4,1,1,36288000,3265920,322560,35280,4320,600,96,18,4,1,1
%N A177262 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} starting with exactly k consecutive integers (1<=k<=n).
%H A177262 G. C. Greubel, <a href="/A177262/b177262.txt">Rows n = 1..50 of the triangle, flattened</a>
%F A177262 T(n, k) = (n-k)*(n-k)! if k < n, otherwise T(n,n) = 1.
%F A177262 T(n, 1) = A094258(n) = (n-1)!(n-1).
%F A177262 Sum_{k=1..n} T(n, k) = A000142(n) (row sums).
%F A177262 Sum_{k=1..n} k*T(n,k) = Sum_{j=1..n} j! = A007489(n).
%F A177262 Sum_{k=1..floor((n+1)/2)} T(n-k+1, k) = A005165(n). - _G. C. Greubel_, May 18 2024
%e A177262 T(4,2)=4 because we have 1243, 2314, 3412, and 3421.
%e A177262 Triangle starts:
%e A177262       1;
%e A177262       1,    1;
%e A177262       4,    1,   1;
%e A177262      18,    4,   1,  1;
%e A177262      96,   18,   4,  1,  1;
%e A177262     600,   96,  18,  4,  1,  1;
%e A177262    4320,  600,  96, 18,  4,  1,  1;
%e A177262   35280, 4320, 600, 96, 18,  4,  1,  1;
%p A177262 T := proc (n, k) if k = n then 1 elif k < n then factorial(n-k)*(n-k) else 0 end if end proc: for n to 11 do seq(T(n, k), k = 1 .. n) end do; # yields sequence in triangular form
%t A177262 T[n_, k_]:= (n-k+1)! -(n-k)! +Boole[k==n];
%t A177262 Table[T[n,k], {n,12}, {k,n}]//Flatten (* _G. C. Greubel_, May 18 2024 *)
%o A177262 (Magma)
%o A177262 A177262:= func< n,k | k eq n select 1 else (n-k)*Factorial(n-k) >;
%o A177262 [A177262(n,k): k in [1..n], n in [1..12]]; // _G. C. Greubel_, May 18 2024
%o A177262 (SageMath)
%o A177262 def A177262(n,k): return (n-k)*factorial(n-k) + int(k==n)
%o A177262 flatten([[A177262(n,k) for k in range(1,n+1)] for n in range(1,13)]) # _G. C. Greubel_, May 18 2024
%Y A177262 Cf. A000142 (row sums), A005165, A007489, A094258.
%K A177262 nonn,tabl
%O A177262 1,4
%A A177262 _Emeric Deutsch_, May 15 2010