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.

Previous Showing 21-28 of 28 results.

A155518 Number of permutations p of {1,2,...,n} such that p(j) + p(n+1-j) != n+1 for all j.

Original entry on oeis.org

1, 0, 0, 4, 16, 64, 384, 2880, 23040, 208896, 2088960, 23193600, 278323200, 3640688640, 50969640960, 768126320640, 12290021130240, 209688566169600, 3774394191052800, 71921062285148160, 1438421245702963200
Offset: 0

Views

Author

Emeric Deutsch, Jan 26 2009

Keywords

Examples

			a(3)=4 because we have 132, 312, 213 and 231 (123 and 321 do not qualify).
		

Crossrefs

Programs

  • Maple
    g[0] := 1: g[1] := 0: for n from 2 to 20 do g[n] := (2*(n-1))*(g[n-1]+g[n-2]) end do: a := proc (n) if `mod`(n, 2) = 1 then factorial((1/2)*n-1/2)*2^((1/2)*n-1/2)*g[(1/2)*n+1/2] else factorial((1/2)*n)*2^((1/2)*n)*g[(1/2)*n] end if end proc: seq(a(n), n = 0 .. 24);

Formula

a(n) = A155517(n,0).
a(2n-1) = (n-1)!*2^(n-1)*g(n), a(2n) = n!*2^n*g(n), where g(n) = A053871(n) is defined by g(0)=1, g(1)=0, g(n) = 2(n-1)*(g(n-1) + g(n-2)) for n>=2.

A189849 a(0)=1, a(1)=0, a(n) = 4*n*(n-1)*(a(n-1) + 2*(n-1)*a(n-2)).

Original entry on oeis.org

1, 0, 16, 384, 23040, 2088960, 278323200, 50969640960, 12290021130240, 3774394191052800, 1438421245702963200, 666120016990568448000, 368420070161105761075200, 239869937154980747988172800, 181598769336835394381021184000, 158184707164826878472739618816000
Offset: 0

Views

Author

Stewart Herring, Apr 29 2011

Keywords

Comments

The number of ways n couples can sit in rows of two seats with no person next to their partner.
a(n)/(2n)! gives the probability of this is and tends to exp(-1/2) as n tends to infinity.

Crossrefs

Programs

  • Magma
    [(-2)^n*Factorial(n)*(&+[(-1/2)^k*Binomial(n,k)*Factorial(2*k)/Factorial(k): k in [0..n]]): n in [0..20]]; // G. C. Greubel, Jan 13 2018
  • Maple
    a:= n-> (-2)^n*n!*add((-1/2)^i*binomial(n, i)*(2*i)!/i!, i=0..n): seq(a(n), n=0..20);
  • Mathematica
    Table[(-2)^n*n!*Sum[(-1/2)^i*Binomial[n,i]*(2*i)!/i!,{i,0,n}],{n,1,20}]
    RecurrenceTable[{a[0]==1,a[1]==0,a[n]==4n(n-1)(a[n-1]+2(n-1)a[n-2])},a,{n,20}] (* Harvey P. Dale, May 02 2012 *)
  • Maxima
    a[0]:1$ a[1]:0$ a[n]:=4*n*(n-1)*(a[n-1]+2*(n-1)*a[n-2])$ makelist(a[n], n, 0, 13);  /* Bruno Berselli, May 23 2011 */
    
  • PARI
    for(n=0,30, print1((-2)^n*n!*sum(k=0,n, (-1/2)^k*binomial(n,k)*(2*k)!/k!), ", ")) \\ G. C. Greubel, Jan 13 2018
    

Formula

a(n) = (-2)^n*n!*hypergeom([ -n, 1/2],[],2).
a(n) = (n!)^2 times the coefficient of x^n in the expansion of exp(-2*x)/sqrt(1-4*x).
a(n) = 2^n*n!*A053871(n).
a(n) = A333706(2n,n). - Alois P. Heinz, Apr 10 2020

A292080 Number of nonequivalent ways to place n non-attacking rooks on an n X n board with no rook on 2 main diagonals up to rotations and reflections of the board.

Original entry on oeis.org

1, 0, 0, 0, 2, 2, 14, 84, 630, 6096, 55336, 672160, 7409300, 104999520, 1366363752, 22068387264, 331233939624, 6005919062528, 102144359744192, 2054811316442112, 39053339674065360, 863259240785840640, 18132529836143846560, 436899062862222484480
Offset: 0

Views

Author

Andrew Howroyd, Sep 12 2017

Keywords

Comments

For odd n, there are no symmetrical configurations of non-attacking rooks without a rook in the main diagonal, so a(2n+1) = A003471(2n+1) / 8. For even n, configurations with rotational and diagonal symmetry are possible.

Examples

			Case n=4: The 2 nonequivalent solutions are:
   _ x _ _     _ x _ _
   x _ _ _     _ _ _ x
   _ _ _ x     x _ _ _
   _ _ x _     _ _ x _
Case n=5: The 2 nonequivalent solutions are:
   _ x _ _ _   _ x _ _ _
   x _ _ _ _   _ _ _ _ x
   _ _ _ x _   x _ _ _ _
   _ _ _ _ x   _ _ x _ _
   _ _ x _ _   _ _ _ x _
		

Crossrefs

Programs

  • Mathematica
    sf[n_] := n! * SeriesCoefficient[Exp[-x ] / (1 - x), {x, 0, n}];
    F[n_] := (Clear[v]; v[_] = 0; For[m = 4, m <= n, m++, v[m] = (m - 1)*v[m - 1] + 2*If[OddQ[m], (m - 1)*v[m - 2], (m - 2)*If[m == 4, 1, v[m - 4]]]]; v[n]);
    d[n_] := Sum[(-1)^(n-k)*Binomial[n, k]*(2k)!/(2^k*k!), {k, 0, n}];
    R[n_] := If[OddQ[n], 0, (n - 1)!*2/(n/2 - 1)!];
    a[0] = 1; a[n_] := (F[n] + If[OddQ[n], 0, m = n/2; 2^m * sf[m] + 2*R[m] + 2*d[m]])/8;
    Table[a[n], {n, 0, 23}] (* Jean-François Alcover, Dec 28 2017, after Andrew Howroyd *)
  • PARI
    \\ here sf is A000166, F is A003471, D is A053871, R(n) is A037224(2n).
    sf(n) = {n! * polcoeff( exp(-x + x * O(x^n)) / (1 - x), n)}
    F(n) = {my(v = vector(n)); for(n=4,length(v),v[n]=(n-1)*v[n-1]+2*if(n%2==1,(n-1)*v[n-2],(n-2)*if(n==4,1,v[n-4]))); v[n]}
    D(n) = {sum(k=0, n, (-1)^(n-k) * binomial(n,k) * (2*k)!/(2^k*k!))}
    R(n) = {if(n%2==1, 0, (n-1)!*2/(n/2-1)!)}
    a(n) = {(F(n) + if(n%2==1, 0, my(m=n/2); 2^m * sf(m) + 2*R(m) + 2*D(m)))/8}

Formula

a(2n+1) = A003471(2n+1) / 8, a(2n) = (A003471(2n) + 2^n * A000166(n) + 2*A037224(2*n) + 2*A053871(n)) / 8.

A370253 Number of deranged matchings of 2n people with partners (of either sex) such that at least one person is matched with their spouse.

Original entry on oeis.org

0, 1, 1, 7, 45, 401, 4355, 56127, 836353, 14144545, 267629139, 5601014255, 128455425593, 3203605245777, 86317343312395, 2498680706048191, 77336483434140705, 2548534969132415297, 89087730603300393443, 3292572900736818264015, 128281460895447809211529
Offset: 0

Views

Author

Sam Coutteau, Feb 13 2024

Keywords

Examples

			For n=0, there is no matching which has at least one person matched with their original partner.
For n=1, there are only 2 people, so there is only one way to match them and it is with their original partner.
For n=2, we have two couples, A0 with A1, and B0 with B1. Of the three ways to match them [(A0,A1),(B0,B1)], [(A0,B0),(A1,B1)] and [(A0,B1),(A1,B0)], only the first matching has a person matched up with their original partner.
		

Crossrefs

Cf. A001147 (total number of matchings for 2n people).
Cf. A053871 (number of deranged matchings of 2n people with partners (of either sex) other than their spouse).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, signum(n),
          (4*n-7)*a(n-1)-2*(2*n^2-10*n+11)*a(n-2)-2*(n-2)*(2*n-5)*a(n-3))
        end:
    seq(a(n), n=0..20);  # Alois P. Heinz, Feb 14 2024
  • Mathematica
    a[n_] := Sum[(-1)^(n-i+1)*Binomial[n, i]*(2i-1)!!, {i, 0, n-1}];
    Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Feb 29 2024 *)
  • Python
    import math
    A001147 = lambda i: math.factorial(2*i) // ( 2 ** i * math.factorial(i) )
    A370253 = lambda n: int( sum( (-1)**(i+1) * math.comb(n,n-i) * A001147(n-i) for i in range(1,n+1) ) )
    print( ", ".join( str(A370253(i)) for i in range(0,21) ) )

Formula

a(n) = A001147(n) - A053871(n).
a(n) = Sum_{i=0..n-1} (-1)^(n - i + 1) * binomial(n,i)*A001147(i).
a(n) mod 2 = A057427(n).
a(n) = Sum_{k=1..n} A055140(n,k). - Alois P. Heinz, Feb 14 2024

A297474 Number of maximal matchings in the n-cocktail party graph.

Original entry on oeis.org

1, 2, 14, 92, 844, 9304, 121288, 1822736, 31030928, 590248736, 12406395616, 285558273472, 7143371664064, 192972180052352, 5598713198048384, 173627942889668864, 5731684010612723968, 200669613102747214336, 7426773564495661485568, 289713958515451427511296
Offset: 1

Views

Author

Eric W. Weisstein, Dec 30 2017

Keywords

Comments

A maximal matching in the n-cocktail party graph is either a perfect matching or a matching with a single unmatched pair. - Andrew Howroyd, Dec 30 2017

Crossrefs

Cf. A053871.

Programs

  • Mathematica
    Table[(-1)^(n + 1) (n HypergeometricPFQ[{1/2, 1 - n}, {}, 2] - HypergeometricPFQ[{1/2, -n}, {}, 2]), {n, 20}]
    Table[-I (-1)^n (n HypergeometricU[1/2, n + 1/2, -1/2] - HypergeometricU[1/2, n + 3/2, -1/2])/Sqrt[2], {n, 20}]
  • PARI
    \\ here b(n) is A053871.
    b(n)={if(n<1, n==0, sum(k=0, n, (-1)^(n-k)*binomial(n,k)*(2*k)!/(2^k*k!)))}
    a(n)=b(n) + n*b(n-1); \\ Andrew Howroyd, Dec 30 2017

Formula

a(n) = A053871(n) + n*A053871(n-1). - Andrew Howroyd, Dec 30 2017

Extensions

a(9)-a(20) from Andrew Howroyd, Dec 30 2017

A382134 Number of completely asymmetric matchings (not containing centered or coupled arcs) of [2n].

Original entry on oeis.org

1, 0, 0, 8, 48, 384, 4480, 59520, 897792, 15368192, 293769216, 6198589440, 143130972160, 3590253477888, 97214510235648, 2826205634330624, 87801981951344640, 2902989352269250560, 101776549707306237952, 3771425415371470405632, 147285455218020210180096
Offset: 0

Views

Author

R. J. Mathar, Mar 17 2025

Keywords

Crossrefs

Programs

  • Maple
    g:= exp(-x-x^2)/sqrt(1-2*x) ;
    seq( coeftayl(g,x=0,n)*n!,n=0..10) ;

Formula

E.g.f: exp(-x-x^2)/sqrt(1-2*x).
a(n) = 2^n * A001205(n).
D-finite with recurrence a(n) +2*(-n+1)*a(n-1) -4*(n-1)*(n-2)*a(n-3)=0.

A372260 Triangle read by rows: T(n, k) = (T(n-1, k-1) + T(n-1, k)) * 2 * n with initial values T(n, 0) = Sum_{i=0..n} (-1)^(n-i) * binomial(n, i) * A001147(i) and T(i, j) = 0 if j > i.

Original entry on oeis.org

1, 0, 2, 2, 8, 8, 8, 60, 96, 48, 60, 544, 1248, 1152, 384, 544, 6040, 17920, 24000, 15360, 3840, 6040, 79008, 287520, 503040, 472320, 230400, 46080, 79008, 1190672, 5131392, 11067840, 13655040, 9838080, 3870720, 645120, 1190672, 20314880, 101153024, 259187712, 395566080, 375889920, 219340800, 72253440, 10321920
Offset: 0

Views

Author

Werner Schulte, Apr 24 2024

Keywords

Examples

			Triangle T(n, k) starts:
n\k :     0       1       2        3        4       5       6      7
====================================================================
  0 :     1
  1 :     0       2
  2 :     2       8       8
  3 :     8      60      96       48
  4 :    60     544    1248     1152      384
  5 :   544    6040   17920    24000    15360    3840
  6 :  6040   79008  287520   503040   472320  230400   46080
  7 : 79008 1190672 5131392 11067840 13655040 9838080 3870720 645120
  etc.
		

Crossrefs

Cf. A053871 (column 0), 2*A179540 (column 1), A000165 (main diagonal).
Cf. A001147.

Programs

  • Maple
    T := proc(n, k) option remember; `if`(k > n, 0, `if`(k = n, 2^n * n!, `if`(k = 0, `if`(n < 2, 1 - n, (2*n - 2) * (T(n-1, k) + T(n-2, k))), (T(n-1, k-1) + T(n-1, k)) * 2*n))) end:
    for n from 0 to 7 do seq(T(n, k), k = 0..n) od;  # Peter Luschny, Apr 25 2024
  • Mathematica
    T[n_,k_]:=n!SeriesCoefficient[(Exp[-t]/Sqrt[1 - 2*t])*(2*t/(1-2*t))^k,{t,0,n}]; Table[T[n,k],{n,0,8},{k,0,n}]//Flatten (* Stefano Spezia, Apr 25 2024 *)
  • PARI
    {  T(n, k) = if(k>n, 0, if(k==n, 2^n * n!, if(k==0, if(n<2, 1-n,
             (2*n-2) * (T(n-1, k) + T(n-2, k))), (T(n-1, k-1) + T(n-1, k)) * 2*n)))  }
    
  • PARI
    memo = Map(); memoize(f, A[..]) =
    { my(res);
      if(!mapisdefined(memo, [f, A], &res), res = call(f, A);
      mapput(memo, [f, A], res)); res; }
    T(n, k) =
    { if(k>n, 0, if(k==n, 2^n * n!, if(k==0, if(n<2, 1 - n,
      (2 * n - 2) * (memoize(T, n-1, k) + memoize(T, n-2, k))),
      (memoize(T, n-1, k-1) + memoize(T, n-1, k)) * 2 * n))); }

Formula

T(n, 0) = (2*n - 2) * (T(n-1, 0) + T(n-2, 0)) for n > 1 with initial values T(n, 0) = 1 - n for n < 2 (see A053871).
T(n, k) = (Sum_{i=0..k} binomial(k, i) * T(n-i, 0)) * 2^(2*k) * binomial(n, k) / binomial(2*k, k).
E.g.f. of column k: (exp(-t) / sqrt(1 - 2*t)) * (2*t / (1 - 2*t))^k.
E.g.f.: exp((2*x / (1 - 2*t) - 1) * t) / sqrt(1 - 2*t).

A382139 Number of matchings of [2n] with no coupled arcs.

Original entry on oeis.org

1, 1, 1, 9, 81, 705, 7665, 100905, 1524705, 26022465, 496042785, 10445342985, 240779831985, 6030718158465, 163087008669585, 4735950860666025, 146987669673669825, 4855606200012593025, 170101350767940617025, 6298861062893921346825, 245834199405298416337425
Offset: 0

Views

Author

R. J. Mathar, Mar 17 2025

Keywords

Crossrefs

Programs

  • Maple
    g:= exp(-x^2)/sqrt(1-2*x) ;
    seq( coeftayl(g,x=0,n)*n!,n=0..10) ;

Formula

E.g.f: exp(-x^2)/sqrt(1-2*x).
Exponential convolution of A067994 and A001147.
D-finite with recurrence a(n) +(-2*n+1)*a(n-1) +2*(n-1)*a(n-2) -4*(n-1)*(n-2)*a(n-3)=0.
Previous Showing 21-28 of 28 results.