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.

Showing 1-3 of 3 results.

A152662 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} for which k is the maximal number of initial odd entries (0 <= k <= ceiling(n/2)).

Original entry on oeis.org

1, 0, 1, 1, 1, 2, 2, 2, 12, 8, 4, 48, 36, 24, 12, 360, 216, 108, 36, 2160, 1440, 864, 432, 144, 20160, 11520, 5760, 2304, 576, 161280, 100800, 57600, 28800, 11520, 2880, 1814400, 1008000, 504000, 216000, 72000, 14400, 18144000, 10886400, 6048000, 3024000
Offset: 0

Views

Author

Emeric Deutsch, Dec 13 2008

Keywords

Comments

Sum of entries in row n is n! (A000142).
Row n has 1 + ceiling(n/2) entries.
T(n,0) = A052591(n-1) for n>=1.
Sum_{k=0..ceiling(n/2)} k*T(n,k) = A152663(n).

Examples

			T(3,0)=2 because we have 213 and 231.
T(4,2)=4 because we have 1324, 1342, 3124 and 3142.
Triangle starts:
    1;
    0,   1;
    1,   1;
    2,   2,   2;
   12,   8,   4;
   48,  36,  24,  12;
  360, 216, 108,  36;
  ...
		

Crossrefs

Programs

  • Maple
    T := proc (n, k) if n=0 and k=0 then 1 elif n = 1 and k = 0 then 0 elif n = 1 and k = 1 then 1 elif `mod`(n, 2) = 1 then (1/2)*(n-1)*binomial((1/2)*n+1/2, k)*factorial(k)*factorial(n-1-k) else (1/2)*n*binomial((1/2)*n, k)*factorial(k)*factorial(n-1-k) end if end proc: for n from 0 to 11 do seq(T(n, k), k = 0 .. ceil((1/2)*n)) end do; # yields sequence in triangular form
  • Mathematica
    T[n_, k_] := T[n, k] = Which[n == 0 && k == 0, 1, n == 1 && k == 1, 1, OddQ[n], (n - 1)/2*k!*(n - k - 1)!*Binomial[(n - 1)/2 + 1, k], True, n/2*k!*(n - k - 1)!*Binomial[n/2, k]];
    Table[T[n, k], {n, 0, 11}, {k, 0, Ceiling[n/2]}] // Flatten (* Jean-François Alcover, Apr 04 2024 *)

Formula

T(2n+1,k) = n*k!*(2n-k)!*binomial(n+1,k) (n>= 1);
T(2n,k) = n*k!*(2n-1-k)!*binomial(n,k).
From Alois P. Heinz, Apr 02 2024: (Start)
Sum_{k>=0} (k+1) * T(n,k) = A256881(n+1).
T(n,ceiling(n/2)) = A010551(n). (End)

Extensions

T(0,0)=1 prepended by Alois P. Heinz, Apr 02 2024

A152663 Number of leading odd entries in all permutations of {1,2,...,n} (see example).

Original entry on oeis.org

1, 1, 6, 16, 120, 540, 5040, 32256, 362880, 3024000, 39916800, 410572800, 6227020800, 76281004800, 1307674368000, 18598035456000, 355687428096000, 5762136335155200, 121645100408832000, 2211729098342400000, 51090942171709440000, 1030334000462807040000
Offset: 1

Views

Author

Emeric Deutsch, Dec 13 2008

Keywords

Comments

a(n) = Sum_{k=0..ceiling(n/2)} k*A152662(n,k).

Examples

			a(3) = 6 because in the permutations 123, 132, 213, 231, 312, 321 we have 1+2+0+0+2+1 = 6 leading odd entries.
		

Crossrefs

Programs

  • Maple
    ao := proc (n) options operator, arrow; factorial(2*n+1) end proc: ae := proc (n) options operator, arrow: n*factorial(2*n)/(n+1) end proc: a := proc (n) if `mod`(n, 2) = 1 then ao((1/2)*n-1/2) else ae((1/2)*n) end if end proc: seq(a(n), n = 1 .. 20);
  • Mathematica
    a[n_] := If[OddQ[n], n!, n*n!/(n+2)];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Apr 02 2024 *)

Formula

a(2n+1) = (2n+1)!;
a(2n) = n(2n)!/(n+1).
D-finite with recurrence 2*(n+2)*a(n) +3*(-n-1)*a(n-1) -2*n*(n-1)*(n+1)*a(n-2) +(n-2)*(n-1)^2*a(n-3)=0. - R. J. Mathar, Jul 26 2022

A152665 Number of leading even entries in all permutations of {1,2,...,n}.

Original entry on oeis.org

0, 1, 2, 16, 60, 540, 3024, 32256, 241920, 3024000, 28512000, 410572800, 4670265600, 76281004800, 1017080064000, 18598035456000, 284549942476800, 5762136335155200, 99527809425408000, 2211729098342400000, 42575785143091200000, 1030334000462807040000
Offset: 1

Views

Author

Emeric Deutsch, Dec 13 2008

Keywords

Examples

			The permutation 4,6,2,1,5,3  begins with three even numbers, so would contribute 3 to a(6).
a(3)=2 because in the permutations 123, 132, 213, 231, 312, 321 we have 0+0+1+1+0+0 = 2 leading odd entries.
a(45) = 16: Here are the permutations of 1234, 24 in all:
1(234) total 6, no. of initial even terms  = 0
3(124) ditto
21(34) total 2, no. of initial even terms 1*2 = 2
23(14) ditto
24(13) total 2, no. of initial even terms 2 twice = 4
Subtotal from 2*** is 2+2+4 = 8
Subtotal from 4*** is also 2+2+4 = 8
Total a(4) = 8+8 = 16.
		

Crossrefs

Programs

  • Maple
    ao := proc (n) options operator, arrow; n*factorial(2*n+1)/(n+2) end proc: ae := proc (n) options operator, arrow; n*factorial(2*n)/(n+1) end proc: a := proc (n) if `mod`(n, 2) = 1 then ao((1/2)*n-1/2) else ae((1/2)*n) end if end proc; seq(a(n), n = 1 .. 20);
  • Mathematica
    a[n_] := If[OddQ[n], (n-1)*n!/(n+3), n*n!/(n+2)];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Apr 29 2023 *)

Formula

a(n) = Sum_{k=0..floor(n/2)} k*A152664(n,k).
a(2n+1) = n(2n+1)!/(n+2);
a(2n) = n(2n)!/(n+1).
D-finite with recurrence 2*(n+3)*a(n) +(-5*n-8)*a(n-1) +(-2*n^3-2*n^2-n-4)*a(n-2) +(n-2)*(3*n^2-3*n+2)*a(n-3) +(n-3)*(n-2)^2*a(n-4)=0. - R. J. Mathar, Jul 26 2022

Extensions

Examples expanded by N. J. A. Sloane, Sep 09 2019
Showing 1-3 of 3 results.