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.

A152666 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k runs of odd entries (1<=k<=ceiling(n/2)). For example, the permutation 321756498 has 3 runs of odd entries: 3, 175 and 9.

Original entry on oeis.org

1, 2, 4, 2, 12, 12, 36, 72, 12, 144, 432, 144, 576, 2592, 1728, 144, 2880, 17280, 17280, 2880, 14400, 115200, 172800, 57600, 2880, 86400, 864000, 1728000, 864000, 86400, 518400, 6480000, 17280000, 12960000, 2592000, 86400, 3628800, 54432000
Offset: 1

Views

Author

Emeric Deutsch, Dec 14 2008

Keywords

Comments

Sum of entries in row n is n! (=A000142(n)).
Row n contains ceiling(n/2) entries.
T(n,1) = A010551(n+1).
Sum_{k>=1} k*T(n,k) = A052618(n-1).
Mirror image of A134435.

Examples

			T(3,2)=2 because we have 123 and 321.
T(4,2)=12 because we have 1234, 1432, 3214, 3412, 1243, 3241 and their reverses.
Triangle starts:
1;
2;
4,2;
12,12;
36,72,12;
144,432,144;
576,2592,1728,144.
		

Crossrefs

Programs

  • Maple
    ae := proc (n, k) options operator, arrow: factorial(n)^2*binomial(n+1, k)*binomial(n-1, k-1) end proc: ao := proc (n, k) options operator, arrow: factorial(n)*factorial(n+1)*binomial(n, k-1)*binomial(n+1, k) end proc: T := proc (n, k) if `mod`(n, 2) = 0 then ae((1/2)*n, k) else ao((1/2)*n-1/2, k) end if end proc: for n to 12 do seq(T(n, k), k = 1 .. ceil((1/2)*n)) end do; # yields sequence in triangular form
  • Mathematica
    T[n_?EvenQ, k_] := (n/2)!^2*Binomial[n/2 - 1, k - 1]*Binomial[n/2 + 1, k]; T[n_?OddQ, k_] := ((n - 1)/2 + 1)!*((n - 1)/2)!*Binomial[(n - 1)/2 + 1, k]*Binomial[(n - 1)/2, k - 1]; Table[T[n, k], {n, 1, 12}, {k, 1, Floor[(n + 1)/2]}] // Flatten (* Jean-François Alcover, Nov 13 2016 *)

Formula

T(2n,k) = (n!)^2*binomial(n+1,k)*binomial(n-1,k-1).
T(2n+1,k) = n!*(n+1)!*binomial(n,k-1)*binomial(n+1,k).

A152668 Number of runs of even entries in all permutations of {1,2,...,n} (the permutation 274831659 has 3 runs of even entries: 2, 48 and 6).

Original entry on oeis.org

2, 6, 36, 192, 1440, 10800, 100800, 967680, 10886400, 127008000, 1676505600, 22992076800, 348713164800, 5492232345600, 94152554496000, 1673823191040000, 32011868528640000, 633834996867072000, 13380961044971520000
Offset: 2

Views

Author

Emeric Deutsch, Dec 14 2008

Keywords

Comments

a(n) = Sum(k*A152667(n,k), k=1..floor(n/2)).

Examples

			a(3) = 6 because each of the permutations 123, 132, 213, 231, 312, 321 has exactly 1 run of even entries.
		

Crossrefs

Programs

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

Formula

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

A152873 Number of permutations of {1,2,...,n} (n>=2) having a single run of even entries. For example, the permutation 513284679 has a single run of even entries: 2846.

Original entry on oeis.org

2, 6, 12, 48, 144, 720, 2880, 17280, 86400, 604800, 3628800, 29030400, 203212800, 1828915200, 14631321600, 146313216000, 1316818944000, 14485008384000, 144850083840000, 1738201006080000, 19120211066880000, 248562743869440000, 2982752926433280000, 41758540970065920000
Offset: 2

Views

Author

Emeric Deutsch, Dec 14 2008

Keywords

Examples

			a(4) = 12 because we have 2413, 2431, 4213, 4231, 1243, 1423 and their reverses.
		

Crossrefs

Programs

  • Maple
    ae := proc (n) options operator, arrow: factorial(n)^2*(n+1) end proc: ao := proc (n) options operator, arrow: factorial(n)*factorial(n+2) end proc: a := proc (n) if `mod`(n, 2) = 0 then ae((1/2)*n) else ao((1/2)*n-1/2) end if end proc; seq(a(n), n = 2 .. 23);
    # second Maple program:
    a:= n-> (h-> h!*(h+1+(n mod 2))!)(iquo(n, 2)):
    seq(a(n), n=2..25);  # Alois P. Heinz, Sep 24 2024
  • Mathematica
    a[n_] := If[OddQ[n], ((n - 1)/2)!*((n + 3)/2)!, (n/2 + 1) ((n/2)!)^2]; Array[a, 25, 2] (* Amiram Eldar, Jan 22 2023 *)

Formula

a(n) = A152667(n,1).
a(2n) = (n+1)(n!)^2;
a(2n+1) = n!(n+2)!
E.g.f.: 24*sqrt(4-x^2)*arcsin(x/2)/[(2-x)^3*(2+x)^2] - x(6-8x-3x^2+2x^3)/ [(2+x)(2-x)^2].
G.f.: G(0)/x^2 -1/x^2 -2/x, where G(k) = 1 + x*(k+2)/(1 - x*(k+1)/ (x*(k+1) + 1/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jun 07 2013
D-finite with recurrence 4*a(n) -2*a(n-1) -(n+2)*(n-1)*a(n-2)=0. - R. J. Mathar, Jul 24 2022
Sum_{n>=2} 1/a(n) = BesselI(1, 2) + BesselI(2, 2) - 3/2 = A096789 + A229020 - 3/2. - Amiram Eldar, Jan 22 2023
Showing 1-3 of 3 results.