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.

A259834 Number of permutations of [n] with no fixed points where the maximal displacement of an element equals n-1.

Original entry on oeis.org

0, 0, 1, 2, 5, 20, 97, 574, 3973, 31520, 281825, 2803418, 30704101, 367114252, 4757800705, 66432995030, 994204132517, 15875195019224, 269397248811073, 4841453414347570, 91856764780324165, 1834779993945449348, 38485629141294791201, 845788826477292504302
Offset: 0

Views

Author

Alois P. Heinz, Jul 06 2015

Keywords

Comments

a(n) counts permutations p of [n] such that p(i) <> i and (p(1) = n or p(n) = 1).

Examples

			a(2) = 1: 21.
a(3) = 2: 231, 312.
a(4) = 5: 2341, 3421, 4123, 4312, 4321.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<3, [0, 0, 1][n+1],
         ((2*n^2-11*n+13)*a(n-1) +(2*n-5)*(n-3)*a(n-2))/(2*n-7))
        end:
    seq(a(n), n=0..30);
  • Mathematica
    Join[{0, 0}, Table[DifferenceRoot[Function[{y, m}, {y[1 + m] == (n - m)*y[m] + (n - m) y[m - 1], y[0] == 0, y[1] == 1, y[2] == 1}]][n], {n, 2, 30}]] (* Benedict W. J. Irwin, Nov 03 2016 *)
    Table[If[n<2, 0, Subfactorial[n-2]+2*Subfactorial[n-1]], {n,0,23}] (* Peter Luschny, Oct 04 2017 *)
  • Python
    def A259834_list(len):
        L, u, x, y = [0], 1, 0, 0
        for n in range(len):
            y, x, u = x, x*n + u, -u
            L.append(y + 2*x)
        L[1] = 0
        return L
    print(A259834_list(23)) # Peter Luschny, Oct 04 2017

Formula

a(n) = ((2*n^2-11*n+13)*a(n-1) + (2*n-5)*(n-3)*a(n-2))/(2*n-7) for n > 2.
a(n) = (n-2)! * [x^(n-2)] exp(-x)*(x+1)/(x-1)^2 for n > 1.
a(n) ~ 2 * (n-1)! / exp(1). - Vaclav Kotesovec, Jul 07 2015
a(n) = y(n,n), n > 1, where y(m+1,n) = (n-m)*y(m,n) + (n-m)*y(m-1,n), with y(0,n)=0, y(1,n)=y(2,n)=1 for all n. - Benedict W. J. Irwin, Nov 03 2016
From Peter Luschny, Oct 05 2017: (Start)
a(n) = (Gamma(n-1, -1) + 2*Gamma(n, -1)) / e for n >= 2.
a(n) = A000166(n-2) + 2*A000166(n-1) for n >= 2.
a(n) = (2*n-1)*A000166(n-2) - 2*(-1)^n for n >= 2.
a(n) = A000255(n-2) + A000166(n-1) for n >= 2.
a(n+2) = (-1)^n*(-hypergeom([1,1-n], [], 1) + hypergeom([2,2-n], [], 1)) = A292898(2, n) for n >= 0.
a(n) ~ 2*sqrt(2*Pi)*exp(-n-1)*n^(n-1/2). (End)
a(n+2) = A306455(n) + n! for n >= 0. - Alois P. Heinz, Feb 16 2019

A292898 Array read by ascending antidiagonals, A(m, n) = Sum_{k=1..m}(-1)^(k-n-m)* hypergeom([k, k-n-m], [], 1) for m>=1 and n>=0.

Original entry on oeis.org

1, 1, 0, 3, 2, 1, 8, 7, 5, 2, 31, 30, 27, 20, 9, 147, 146, 142, 129, 97, 44, 853, 852, 847, 826, 755, 574, 265, 5824, 5823, 5817, 5786, 5652, 5187, 3973, 1854, 45741, 45740, 45733, 45690, 45463, 44462, 40923, 31520, 14833
Offset: 0

Views

Author

Peter Luschny, Oct 05 2017

Keywords

Examples

			Array starts:
[m\n]   0       1      2       3        4         5          6
-------------------------------------------------------------------
[1]     1,      0,     1,      2,       9,       44,       265, ...  [A000166]
[2]     1,      2,     5,     20,      97,      574,      3973, ...  [A259834(n+2)]
[3]     3,      7,    27,    129,     755,     5187,     40923, ...  [A292897]
[4]     8,     30,   142,    826,    5652,    44462,    394970, ...
[5]    31,    146,   847,   5786,   45463,   403514,   3990679, ...
[6]   147,    852,  5817,  45690,  405423,  4008768,  43692933, ...
[7]   853,   5823, 45733, 405779, 4012101, 43727687, 520723477, ...
  A003470,A193464,A293295.
Displayed as a triangle:
[1]     1;
[2]     1,      0;
[3]     3,      2,     1;
[4]     8,      7,     5,    2;
[5]    31,     30,    27,   20,    9;
[6]   147,    146,   142,  129,   97,   44;
[7]   853,    852,   847,  826,  755,  574,  265;
[8]  5824,   5823,  5817, 5786, 5652, 5187, 3973, 1854;
  A003470,A193464,A293295.
This triangle has row sums A193463.
		

Crossrefs

Programs

  • Maple
    A := (m, n) -> add((-1)^(k-n-m)*hypergeom([k, k-n-m], [], 1), k=1..m):
    seq(lprint(seq(simplify(A(m, n)), n=0..6)), m=1..7);
  • Mathematica
    A[m_, n_] :=  Sum[(-1)^(k-n-m) HypergeometricPFQ[{k, k-n-m},{}, 1], {k, 1, m} ];
    Table[Table[A[m, n], {n,0,6}], {m,1,7}]
Showing 1-2 of 2 results.