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

A007016 Number of permutations of length n with 1 fixed and 1 reflected point.

Original entry on oeis.org

0, 1, 0, 0, 8, 20, 96, 656, 5568, 48912, 494080, 5383552, 65097600, 840566080, 11833898496, 176621049600, 2838024476672, 48060623405312, 868000333234176, 16441638519762944, 329723762151352320, 6907027877807330304
Offset: 0

Views

Author

Keywords

Comments

Number of distinct solutions to the order n checkerboard problem, including symmetrical solutions: place n pieces on an n X n board so there is exactly one piece in each row, column and main diagonal. Compare A064280.
Number of magic permutation matrices of order n. - Chai Wah Wu, Jan 15 2019
Upper bound for the number of diagonal transversals in a Latin square: A287647(n) <= A287648(n) <= a(n). - Eduard I. Vatutin, Jan 02 2020

References

  • Simpson, Todd; Permutations with unique fixed and reflected points. Ars Combin. 39 (1995), 97-108.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    x[n_] := x[n] = Integrate[If[EvenQ[n], (x^2 - 4*x + 2)^(n/2), (x - 1)*(x^2 - 4*x + 2)^((n - 1)/2)]/E^x, {x, 0, Infinity}];
    a[n_ /; EvenQ[n]] := With[{m = n/2}, m*(x[2*m] - (2*m - 3)*x[2*m - 1])];
    a[n_ /; OddQ[n]] := With[{m = (n - 1)/2}, (2*m + 1)*x[2*m] + 3*m*x[2*m - 1] - 2*m*(m - 1)*x[2*m - 2]];
    Table[a[n], {n, 0, 21}] // Quiet (* Jean-François Alcover, Jun 29 2018 *)
  • PARI
    a(n) = {my(v = vector(n)); \\ v is A003471
    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])));
    if(n<4, [1,0,0][n], if(n%2==0, n*(v[n] - (n-3)*v[n-1]), 2*n*v[n-1] + 3*(n-1)*v[n-2] - (n-1)*(n-3)*v[n-3])/2)} \\ Andrew Howroyd, Sep 12 2017

Formula

a(2*m) = m*(x(2*m) - (2*m-3)*x(2*m-1)), a(2*m+1) = (2*m+1)*x(2*m) + 3*m*x(2*m-1) - 2*m*(m-1)*x(2*m-2), where x(n) = A003471(n).
Conjecture D-finite with recurrence (365968635435167109808*n^2 -5566069866485493251505*n +20525522573033552369132)*a(n) +(-1215369044326430542311*n^2 +19103429957352794982854*n -73690801030090785944295)*a(n-1) +(-365968635435167109808*n^4 +6663975772790994580929*n^3 -35836353442786038818589*n^2 +34878550744402035813586*n +124043542472821007763204)*a(n-2) +(483431773456096322695*n^4 -10754417727097457203127*n^3 +85154149458907095778621*n^2 -277683967994722584206067*n +286254870342835757751852)*a(n-3) +2*(-393241909113483884738*n^4 +9142334951839265043383*n^3 -78427160779754271402777*n^2 +309283968160862567580813*n -465057422344277141977923)*a(n-4) +2*(-745044547502580209919*n^4 +21471238686323774026196*n^3 -222067832543690193789255*n^2 +944698954932049830084232*n -1372732531859619119793978)*a(n-5) +4*(365968635435167109808*n^4 -5227374504728642916627*n^3 +19793104565012302929789*n^2 +391834816007939927082*n -57365695502678698166146)*a(n-6) +4*(-483431773456096322695*n^4 +7592214312314395379733*n^3 -45284933032689911393913*n^2 +117535885088909103449165*n -84799883220517633629252)*a(n-7) +8*(n-7)*(393241909113483884738*n^3 -4789400677912625536335*n^2 +17834478528905815208536*n -23668675533486426523455)*a(n-8) +8*(n-7)*(n-8)*(745044547502580209919*n^2 -6086915962816073505121*n +12854159797389104313178)*a(n-9)=0. - R. J. Mathar, Feb 27 2025

A003471 Number of permutations with no hits on 2 main diagonals.

Original entry on oeis.org

1, 0, 0, 0, 4, 16, 80, 672, 4752, 48768, 440192, 5377280, 59245120, 839996160, 10930514688, 176547098112, 2649865335040, 48047352500224, 817154768973824, 16438490531536896, 312426715251262464, 6906073926286725120, 145060238642780180480, 3495192502897779875840
Offset: 0

Views

Author

Keywords

Comments

Permanent of the binary matrix with an entry equal to 0 iff the entry is on the main diagonal or the main antidiagonal. - Simone Severini, Oct 14 2004
From Toby Gottfried, Dec 05 2008: (Start)
Suppose you have a group of married couples (plus perhaps one other person).
You wish to organize a gift exchange so that:
- each person gives and receives one gift.
- no one gives himself a gift.
- no one gives his/her spouse a gift.
Then the sequence gives the number of ways that this can be done. (End)

Examples

			G.f. = 1 + 4*x^4 + 16*x^5 + 80*x^6 + 672*x^7 + 4752*x^8 + ... - _Michael Somos_, Jun 17 2023
		

References

  • J. Riordan, An Introduction to Combinatorial Analysis, Wiley, 1958, p. 187.
  • Todd Simpson, Permutations with unique fixed and reflected points. Ars Combin. 39 (1995), 97-108.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Column k=0 of A335872.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<5, [1, 0$3, 4][n+1],
          (n-1)*a(n-1)+2*`if`(n::even, (n-2)*a(n-4), (n-1)*a(n-2)))
        end:
    seq(a(n), n=0..23);  # Alois P. Heinz, Jun 27 2020
  • Mathematica
    a[n_] := Integrate[m = Mod[n, 2]; k = (n-m)/2; (x^2-4*x+2)^k*(x-1)^m*Exp[-x], {x, 0, Infinity}]; Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Sep 09 2013, after Felix A. Pahl *)
    nmax=20; b=ConstantArray[0,nmax+1]; b[[1]]=1; b[[2]]=0; b[[3]]=0; b[[4]]=0; b[[5]]=4; Do[b[[n+1]] = (n-1)*b[[n]] + If[EvenQ[n],2*(n-2)*b[[n-3]],2*(n-1)*b[[n-1]]],{n,5,nmax}]; b  (* Vaclav Kotesovec, Mar 07 2014 *)
    a[ n_] = If[n<4, Boole[n==0], With[{m =2-Mod[n, 2]}, a[n-1]*(n-1) + 2*(n-m)*a[n-2*m]]]; (* Michael Somos, Jun 17 2023 *)
  • PARI
    {a(n) = if(n<4, n==0, my(m = 2-n%2); a(n-1)*(n-1) + 2*(n-m)*a(n-2*m))}; /* Michael Somos, Jun 17 2023 */

Formula

a(n) = (n-1)*a(n-1) + 2*(n-d)*a(n-e), where (d, e) = (2, 4) if n even, (1, 2) if n odd.
a(n) = Integral_{ x = 0..oo} (x^2-4*x+2)^k * (x-1)^m * exp(-x) dx, where n=2*k+m, m=n mod 2. - Felix A. Pahl, Dec 27 2011
Recurrence: (n-3)*(3*n^3 - 36*n^2 + 137*n - 162)*a(n) = (n-5)*(3*n^3 - 27*n^2 + 71*n - 50)*a(n-1) + (n-2)*(3*n^5 - 45*n^4 + 248*n^3 - 606*n^2 + 608*n - 156)*a(n-2) - 2*(n-3)*(3*n^3 - 28*n^2 + 87*n - 94)*a(n-3) + 2*(3*n^5 - 51*n^4 + 334*n^3 - 1060*n^2 + 1650*n - 1028)*a(n-4) - 4*(n-4)*(n^2 + n - 14)*a(n-5) - 4*(n-5)*(n-4)*(n-2)*(3*n^3 - 27*n^2 + 74*n - 58)*a(n-6). - Vaclav Kotesovec, Mar 07 2014
a(n) ~ exp(-2) * n!. - Vaclav Kotesovec, Mar 07 2014

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Sep 24 2001
Showing 1-2 of 2 results.