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

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

A152874 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} with k parity changes (n>=2; 1<=k <=n-1); the permutation 372185946 has 5 parity changes: 37-2-1-8-59-46.

Original entry on oeis.org

2, 4, 2, 8, 8, 8, 24, 36, 48, 12, 72, 144, 288, 144, 72, 288, 720, 1728, 1296, 864, 144, 1152, 3456, 10368, 10368, 10368, 3456, 1152, 5760, 20160, 69120, 86400, 103680, 51840, 23040, 2880, 28800, 115200, 460800, 691200, 1036800, 691200, 460800, 115200, 28800
Offset: 2

Views

Author

Emeric Deutsch, Dec 15 2008

Keywords

Comments

Sum of entries in row n is n! (A000142(n)).
T(n,n-1) = A092186(n).
T(n,1) = A152875(n).
Sum_{k=1..n-1} k*T(n,k) = 2*A077613(n).

Examples

			T(4,3) = 8 because we have 1243, 1423, 4132, 4312, 2134, 2314, 3241 and 3421.
Triangle starts:
   2;
   4,   2;
   8,   8,   8;
  24,  36,  48,  12;
  72, 144, 288, 144,  72;
  ...
		

Crossrefs

T(2n,n) gives A363180.

Programs

  • Maple
    ae := proc (n, k) if `mod`(k, 2) = 0 then 2*factorial(n)^2*binomial(n-1, (1/2)*k-1)*binomial(n-1, (1/2)*k) else 2*factorial(n)^2*binomial(n-1, (1/2)*k-1/2)^2 end if end proc: ao := proc (n, k) if `mod`(k, 2) = 0 then factorial(n)*factorial(n+1)*(binomial(n, (1/2)*k)*binomial(n-1, (1/2)*k-1)+binomial(n, (1/2)*k-1)*binomial(n-1, (1/2)*k)) else 2*factorial(n)*factorial(n+1)*binomial(n, (1/2)*k-1/2)*binomial(n-1, (1/2)*k-1/2) end if 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 from 2 to 10 do seq(T(n, k), k = 1 .. n-1) end do; # yields sequence in triangular form
    # second Maple program:
    b:= proc(x, y, t) option remember; `if`(x+y=0, 1, `if`(x>0,
          b(x-1, y, z)*x, 0)+`if`(y>0, expand(b(y-1, x, z)*y*t), 0))
        end:
    T:= n-> (h-> (p-> seq(coeff(p, z, i), i=1..n-1))(b(h, n-h, 1)))(iquo(n, 2)):
    seq(T(n), n=2..12);  # Alois P. Heinz, May 23 2023
  • Mathematica
    b[x_, y_, t_] := b[x, y, t] = If[x + y == 0, 1, If[x > 0, b[x - 1, y, z]*x, 0] + If[y > 0, Expand[b[y - 1, x, z]*y*t], 0]];
    T[n_] := Table[Coefficient[#, z, i], {i, 1, n-1}]&[b[#, n-#, 1]]&[ Quotient[n, 2]];
    Table[T[n], {n, 2, 12}] // Flatten (* Jean-François Alcover, Aug 16 2023, after Alois P. Heinz *)

Formula

T(2n,k) = (n!)^2*a(n,k), where a(n,k) is the number of lattice paths from (0,0) to (n,n) with steps N=(0,1) and E=(1,0) and having k turns;
a(n,k) = 2*binomial(n-1,k/2-1)*binomial(n-1,k/2) if k even;
a(n,k) = 2*(binomial(n-1,(k-1)/2))^2 if k odd.
T(2n+1,k) = n!*(n+1)!*b(n,k), where b(n,k) is the number of lattice paths from (0,0) to (n,n+1) with steps N=(0,1) and E=(1,0) and having k turns;
b(n,k) = binomial(n,k/2)*binomial(n-1,k/2-1) + binomial(n,k/2-1)*binomial(n-1,k/2) = (binomial(n,k/2))^2*k(2n-k+1)/(n(2n-k+2)) if k even;
b(n,k) = 2*binomial(n,(k-1)/2)*binomial(n-1,(k-1)/2) if k odd.

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

Original entry on oeis.org

0, 0, 0, 12, 48, 720, 4320, 60480, 483840, 7257600, 72576000, 1197504000, 14370048000, 261534873600, 3661488230400, 73229764608000, 1171676233728000, 25609494822912000, 460970906812416000, 10948059036794880000, 218961180735897600000, 5620003638888038400000
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Floor[n/2]*Floor[n/2 - 1]*(n - 1)!; Array[a, 25] (* Amiram Eldar, Jan 22 2023 *)
  • PARI
    a(n) = n\2 * (n\2-1)*(n-1)! ; \\ Michel Marcus, Aug 29 2013

Formula

a(n) = floor(n/2)*floor(n/2-1)*(n-1)!. Proof: There are floor(n/2)*floor(n/2-1) pairs (r, s) with r and s even 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) = A110660(n+2) * A000142(n-1). - Michel Marcus, Aug 29 2013
Sum_{n>=4} 1/a(n) = CoshIntegral(1) - gamma - 3*e + 8 = A099284 - A001620 - 3*A001113 + 8. - Amiram Eldar, Jan 22 2023

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

Original entry on oeis.org

1, 1, 1, 1, 2, 4, 4, 16, 4, 12, 72, 36, 36, 324, 324, 36, 144, 1728, 2592, 576, 576, 9216, 20736, 9216, 576, 2880, 57600, 172800, 115200, 14400, 14400, 360000, 1440000, 1440000, 360000, 14400, 86400, 2592000, 12960000, 17280000, 6480000, 518400
Offset: 0

Views

Author

Emeric Deutsch, Nov 30 2008

Keywords

Comments

Also number of permutations of {1,2,...,n} having k adjacent pairs of the form (even,odd). Example: T(3,1) = 4 because we have 123, 213, 231 and 321.
Row n contains 1+floor(n/2) entries.
Mirror image of A134434.
Sum of entries in row n = n! = A000142(n).
Sum_{k>=0} k*T(n,k) = A077613(n).

Examples

			T(3,1) = 4 because we have 123, 132, 312 and 321.
Triangle starts:
   1;
   1;
   1,   1;
   2,   4;
   4,  16,   4;
  12,  72,  36;
  36, 324, 324, 36;
  ...
		

Crossrefs

Programs

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

Formula

T(2n,k) = [n!*C(n,k)]^2; T(2n+1,k) = n!*(n+1)!*C(n,k)*C(n+1,k).

A363496 Total number of parity changes within the blocks of all partitions of [n].

Original entry on oeis.org

0, 0, 1, 4, 17, 74, 356, 1808, 9923, 57442, 354407, 2296028, 15704028, 112266048, 841442105, 6564854864, 53413489773, 450789496454, 3950844987040, 35809477617544, 335901221506491, 3250110998386534, 32453151223493139, 333520967584364248, 3528754456836294712
Offset: 0

Views

Author

Alois P. Heinz, Jun 05 2023

Keywords

Examples

			a(4) = 17 = 6*1 + 4*2 + 1*3: 124|3, 12|3|4, 134|2, 1|23|4, 14|2|3, 1|2|34, 123|4, 12|34, 14|23, 1|234, 1234.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, x, y) option remember; `if`(n=0, [1, 0],
         `if`(y=0, 0, (p-> p+[0, p[1]])(b(n-1, y-1, x+1)*y))+
            b(n-1, y, x)*x + b(n-1, y, x+1))
        end:
    a:= n-> b(n, 0$2)[2]:
    seq(a(n), n=0..24);

Formula

a(n) = Sum_{k=0..max(0,n-1)} k * A363493(n,k).

A060408 Triangle T(n,k) in which n-th row gives numbers of super edge-magic labelings of (n,k)-graphs, for n >= 2, and 1 <= k <= 2n-3.

Original entry on oeis.org

1, 3, 2, 1, 6, 6, 6, 4, 2, 10, 14, 20, 24, 24, 16, 8, 15, 26, 48, 80, 120, 144, 144, 96, 48, 21, 44, 99, 212, 420, 720, 1080, 1296, 1296, 864, 432, 28, 68, 180, 464, 1140, 2520, 5040, 8640, 12960, 15552, 15552, 10368, 5184
Offset: 2

Views

Author

N. J. A. Sloane, Apr 06 2001

Keywords

Comments

(n,k)-graphs are simple graphs with n vertices and k edges.
Row indexed n has length 2n-3.
The diagonal counting the super edge-magic labelings of (n,n)-graphs appears to be A077613(n-1).

Examples

			1; 3,2,1; 6,6,6,4,2; 10,14,20,24,24,16,8; ...
		

Programs

  • Magma
    A060408 := func< n, k | &+[ Integers() | &*[ Integers() | a[j] : j in [i .. i+k-1] ] : i in [3 .. 2*n-k] ] where a is [ j lt 3 select 0 else j le n+1 select (j-1) div 2 else (2*n-j+1) div 2 : j in [1..2*n-1] ] >; [[ A060408(n,k): k in [1..2*n-3] ]: n in [1..10]];

Extensions

Entry T(3,3)=1 (that was erroneously missing from the table of Figueroa-Centeno et al. making the rows appear to be irregular) inserted by, DOI reference provided by, and empirical cross reference for the T(n,n) diagonal observed by Jason Kimberley, Apr 16 2010

A306258 a(n) = floor(n^2/4)*n!.

Original entry on oeis.org

0, 0, 2, 12, 96, 720, 6480, 60480, 645120, 7257600, 90720000, 1197504000, 17244057600, 261534873600, 4271736268800, 73229764608000, 1339058552832000, 25609494822912000, 518592270163968000, 10948059036794880000, 243290200817664000000
Offset: 0

Views

Author

Alaa Sultan Al-hasani, Feb 01 2019

Keywords

Comments

a(n) is the total displacement of all letters in all permutations on n letters as if the first letter were connected to the last letter, forming a loop.
For the sequence A090672 the displacement of the permutation "0123" is 0, while that of the permutation "3210" is 8 because each of the digits 0 and 3 is 3 places away from its original place and each of the digits 1 and 2 is one place away, so the total displacement is 3+1+1+3 = 8.
In this sequence, however, the displacement is calculated differently: that of "0123" is 0 as before, but the displacement of "3210" is no longer 8 because the first index and last index are connected, forming a loop; each of the digits 0 and 3 is now 1 place away from its original place (and each of the digits 1 and 2 is one place away, as before), so the total displacement is calculated as 1+1+1+1 = 4.

Crossrefs

Programs

  • Mathematica
    Table[Floor[n^2/4]n!,{n,0,40}] (* Harvey P. Dale, Jan 16 2023 *)
  • PARI
    a(n) = floor(n^2/4)*n!;

Formula

a(n) = floor(n^2/4)*n!.
a(n) = A002620(n)*n!.
a(n) = A077613(n)*n.
E.g.f.: x^2/((x+1)*(1-x)^3). - Alois P. Heinz, Feb 01 2019

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