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-5 of 5 results.

A052558 a(n) = n! *((-1)^n + 2*n + 3)/4.

Original entry on oeis.org

1, 1, 4, 12, 72, 360, 2880, 20160, 201600, 1814400, 21772800, 239500800, 3353011200, 43589145600, 697426329600, 10461394944000, 188305108992000, 3201186852864000, 64023737057280000, 1216451004088320000, 26761922089943040000, 562000363888803840000
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

Stirling transform of (-1)^(n+1)*a(n-1) = [1, -1, 4, -12, 72, -360, ...] is A052841(n-1) = [1,0,2,6,38,270,...]. - Michael Somos, Mar 04 2004
The Stirling transform of this sequence is A258369. - Philippe Deléham, May 17 2005; corrected by Ilya Gutkovskiy, Jul 25 2018
Ignoring reflections, this is the number of ways of connecting n+2 equally-spaced points on a circle with a path of n+1 line segments. See A030077 for the number of distinct lengths. - T. D. Noe, Jan 05 2007
From Gary W. Adamson, Apr 20 2009: (Start)
Signed: (+ - - + + - - + +, ...) = eigensequence of triangle A002260.
Example: -360 = (1, 1, -1, -4, 12, 71) dot (1, -2, 3, -4, 5, -6) = (1, -2, -3, 16, 60, -432). (End)
a(n) is the number of odd fixed points in all permutations of {1, 2, ..., n+1}, Example: a(2)=4 because we have 1'23', 1'32, 312, 213', 231, and 321, where the odd fixed points are marked. - Emeric Deutsch, Jul 18 2009
a(n) is also the number of permutations of [n+1] starting with an even number. - Olivier Gérard, Nov 07 2011

Crossrefs

Cf. A002260. - Gary W. Adamson, Apr 20 2009
Cf. A052591. - Emeric Deutsch, Jul 18 2009
Cf. A052618, A077611, A199495. - Olivier Gérard, Nov 07 2011

Programs

  • GAP
    List([0..30], n-> ((-1)^n +2*n +3)*Factorial(n)/4); # G. C. Greubel, May 07 2019
  • Magma
    [((-1)^n +2*n +3)*Factorial(n)/4: n in [0..30]]; // G. C. Greubel, May 07 2019
    
  • Maple
    spec := [S,{S=Prod(Sequence(Z),Sequence(Prod(Z,Z)))},labeled]: seq(combstruct[count](spec,size=n), n=0..20);
  • Mathematica
    Table[n!((-1)^n+2n+3)/4,{n,0,30}] (* Harvey P. Dale, Aug 16 2014 *)
  • PARI
    a(n)=if(n<0,0,(1+n\2)*n!)
    
  • PARI
    a(n)=if(n<0, 0, n!*polcoeff(1/(1-x)/(1-x^2)+x*O(x^n), n))
    
  • Sage
    [((-1)^n +2*n +3)*factorial(n)/4 for n in (0..30)] # G. C. Greubel, May 07 2019
    

Formula

D-finite with recurrence a(n) = a(n-1) + (n^2-1)*a(n-2), with a(1)=1, a(0)=1.
a(n) = ((-1)^n + 2*n + 3)*n!/4.
Let u(1)=1, u(n) = Sum_{k=1..n-1} u(k)*k*(-1)^(k-1) then a(n) = abs(u(n+2)). - Benoit Cloitre, Nov 14 2003
E.g.f.: 1/((1-x)*(1-x^2)).
From Emeric Deutsch, Jul 18 2009: (Start)
a(n) = (n+1)!/2 if n is odd; a(n) = n!(n+2)/2 if n is even.
a(n) = (n+1)! - A052591(n). (End)
E.g.f.: G(0)/(1+x) where G(k) = 1 + 2*x*(k+1)/((2*k+1) - x*(2*k+1)*(2*k+3)/(x*(2*k+3) + 2*(k+1)/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Dec 21 2012
Sum_{n>=0} 1/a(n) = e - 1/e = 2*sinh(1) (A174548). - 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

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).

A199495 Number of permutations of [n] starting and ending with an odd number.

Original entry on oeis.org

0, 1, 0, 2, 4, 36, 144, 1440, 8640, 100800, 806400, 10886400, 108864000, 1676505600, 20118067200, 348713164800, 4881984307200, 94152554496000, 1506440871936000, 32011868528640000, 576213633515520000, 13380961044971520000, 267619220899430400000
Offset: 0

Views

Author

Olivier Gérard, Nov 07 2011

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> `if`(n<2, n, ceil(n/2)*(ceil(n/2)-1)*(n-2)!):
    seq(a(n), n=0..30); # Alois P. Heinz, Nov 07 2011

Formula

From Alois P. Heinz, Nov 07 2011: (Start)
a(n) = 2*(n-2)! * [x^(n-2)] x/((1+x)^2*(1-x)^3) for n>=2, else a(n) = n.
a(n) = 2*A152887(n-2) for n>=2, else a(n) = n. (End)

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
Showing 1-5 of 5 results.