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.

A152661 Number of permutations of [n] for which the first two entries have the same parity (n>=2).

Original entry on oeis.org

0, 2, 8, 48, 288, 2160, 17280, 161280, 1612800, 18144000, 217728000, 2874009600, 40236134400, 610248038400, 9763968614400, 167382319104000, 3012881743872000, 57621363351552000, 1152427267031040000, 24329020081766400000, 535238441798860800000
Offset: 2

Views

Author

Emeric Deutsch, Dec 12 2008

Keywords

Comments

a(n) is also the number of 3-term arithmetic progressions of consecutive entries in all permutations of {1,2,...,n}. Example: a(4)=8 because we have 12'3'4, 412'3, 143'2, 23'41, 32'14, 43'2'1 (the mid-terms of the arithmetic progressions are marked). [Emeric Deutsch, Aug 31 2009]

Examples

			a(4)=8 because we have 1324, 1342, 3124, 3142, 2413, 2431, 4213 and 4231.
		

Crossrefs

Cf. A152660.

Programs

  • Maple
    a := proc (n) if `mod`(n, 2) = 0 then 2*factorial((1/2)*n)^2*binomial(n-2, (1/2)*n) else factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2)*binomial(n-1, (1/2)*n-3/2) end if end proc: seq(a(n), n = 2 .. 22);
  • Mathematica
    a[n0_?EvenQ] := With[{n = n0/2}, 2 (n!)^2*Binomial[2*n - 2, n]];
    a[n1_?OddQ] := With[{n = (n1 - 1)/2}, n! (n + 1)! Binomial[2 n, n - 1]];
    Table[a[n], {n, 2, 22}] (* Jean-François Alcover, Nov 28 2017 *)

Formula

a(n) = A152660(n,1).
a(2n) = 2*(n!)^2*binomial(2*n-2,n);
a(2n+1) = n!*(n+1)!*binomial(2n,n-1).
Conjecture: (-n+3)*a(n) +2*(n-2)*a(n-1) +(n-1)*(n-2)*(n-3)*a(n-2)=0. - R. J. Mathar, Apr 20 2015
Conjecture: a(n) = 2*A077613(n-1). - R. J. Mathar, Apr 20 2015