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.

A077613 Number of adjacent pairs of form (even,odd) among all permutations of {1,2,...,n}. Also, number of adjacent pairs of form (odd,even).

Original entry on oeis.org

0, 1, 4, 24, 144, 1080, 8640, 80640, 806400, 9072000, 108864000, 1437004800, 20118067200, 305124019200, 4881984307200, 83691159552000, 1506440871936000, 28810681675776000, 576213633515520000, 12164510040883200000, 267619220899430400000, 6182004002776842240000
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Array[Floor[#/2] Ceiling[#/2] (# - 1)! &, 19] (* Michael De Vlieger, Aug 16 2017 *)
  • PARI
    a(n) = floor(n/2)*ceil(n/2)*(n-1)!; \\ Michel Marcus, Aug 29 2013

Formula

a(n) = floor(n/2)*ceiling(n/2)*(n-1)!. Proof: There are floor(n/2)*ceiling(n/2) pairs (r, s) with r even and s odd. For each pair, there are n-1 places it can occur in a permutation and (n-2)! possible arrangements of the other numbers.
a(n) = A002620(n) * A000142(n-1). - Michel Marcus, Aug 29 2013
Sum_{n>=2} 1/a(n) = 6*(CoshIntegral(1) - gamma) + 2/e - 1 = 6*(A099284 - A001620) + 2*A068985 - 1. - Amiram Eldar, Jan 22 2023

A077611 Number of adjacent pairs of form (odd,odd) among all permutations of {1,2,...,n}.

Original entry on oeis.org

0, 0, 4, 12, 144, 720, 8640, 60480, 806400, 7257600, 108864000, 1197504000, 20118067200, 261534873600, 4881984307200, 73229764608000, 1506440871936000, 25609494822912000, 576213633515520000, 10948059036794880000, 267619220899430400000, 5620003638888038400000
Offset: 1

Views

Author

Keywords

Comments

a(n) is also the number of permutations of [n+1] starting and ending with an even number. - Olivier Gérard, Nov 07 2011

Examples

			For n=4, the a(4) = 12 permutations of degree 5 starting and ending with an even number are 21354, 21534, 23154, 23514, 25134, 25314, 41352, 41532, 43152, 43512, 45132, 45312.
		

Crossrefs

Programs

  • Magma
    [Factorial(n-1)*(2*n*(n-1)-(2*n-1)*(-1)^n-1)/8 : n in [1..30]]; // Vincenzo Librandi, Nov 16 2011
  • Mathematica
    Table[Ceiling[n/2] Ceiling[n/2 - 1] (n - 1)!, {n, 22}] (* Michael De Vlieger, Aug 20 2017 *)

Formula

a(n) = ceiling(n/2)*ceiling(n/2-1)*(n-1)!. Proof: There are ceiling(n/2) * ceiling(n/2-1) pairs (r, s) with r and s odd and distinct. For each pair, there are n-1 places it can occur in a permutation and (n-2)! possible arrangements of the other numbers.
a(n) = (n-1)!*(2*n*(n-1)-(2*n-1)*(-1)^n-1)/8. - Bruno Berselli, Nov 07 2011
Sum_{n>=3} 1/a(n) = 4*(CoshIntegral(1) - gamma - sinh(1) + 1) = 4*(A099284 - A001620 - A073742 + 1). - Amiram Eldar, Jan 22 2023

A145892 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having k adjacent pairs of the form (even,even) (0<=k<=floor(n/2)-1).

Original entry on oeis.org

1, 1, 2, 6, 12, 12, 72, 48, 144, 432, 144, 1440, 2880, 720, 2880, 17280, 17280, 2880, 43200, 172800, 129600, 17280, 86400, 864000, 1728000, 864000, 86400, 1814400, 12096000, 18144000, 7257600, 604800, 3628800, 54432000, 181440000, 181440000, 54432000, 3628800
Offset: 0

Views

Author

Emeric Deutsch, Nov 30 2008

Keywords

Comments

Row n contains floor(n/2) entries (n>=2).
Sum of entries in row n = n! = A000142(n).
Sum_{k>=0} k*T(n,k) = A077612(n).
T(2n,k) = A134435(2n,k).

Examples

			T(4,1) = 12 because we have 1243, 1423, 1324, 1342, 3124, 3142, 2413, 4213, 2431, 4231, 3241 and 3421.
Triangle starts:
     1;
     1;
     2;
     6;
    12,   12;
    72,   48;
   144,  432, 144;
  1440, 2880, 720;
  ...
		

Crossrefs

Programs

  • Maple
    T:=proc(n,k) if `mod`(n, 2) = 0 then factorial((1/2)*n)^2*binomial((1/2)*n-1, k)*binomial((1/2)*n+1, k+1) else factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2)*binomial((1/2)*n-3/2, k)*binomial((1/2)* n+3/2, k+2) end if end proc: 1; 1; for n from 2 to 12 do seq(T(n, k), k = 0 .. floor((1/2)*n)-1) end do; # yields sequence in triangular form
  • Mathematica
    T[n_,k_]:=If[EvenQ[n],((n/2)!)^2Binomial[n/2-1,k]Binomial[n/2+1,k+1], ((n-1)/2)!((n+1)/2)!Binomial[(n-3)/2,k]Binomial[(n+3)/2,k+2]]; Join[{1,1},Flatten[Table[T[n,k],{n,0,12},{k,0,Floor[n/2]-1}]]] (* Stefano Spezia, Jul 12 2024 *)

Formula

T(2n,k) = (n!)^2*C(n-1,k)*C(n+1,k+1); T(2n+1,k) = n!(n+1)! * C(n-1,k) * C(n+2,k+2).
Showing 1-3 of 3 results.