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

A109742 a(n) = d(n-1) + d(n-2) + (n-1)[d(n-2) + 2d(n-3) + d(n-4)], where d(n), the derangement numbers, are given in A000166. (Let d(n) = 0 if n < 0.)

Original entry on oeis.org

1, 2, 5, 9, 27, 123, 693, 4653, 36111, 317583, 3118617, 33804177, 400755267, 5156954019, 71572594557, 1065571143093, 16938122939703, 286298719063863, 5127206924693601, 96975312507734553, 1931609062232400747, 40414621201681598667, 886153986344092389957
Offset: 1

Views

Author

N. J. A. Sloane, Aug 13 2005

Keywords

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[2] = 2; a[3] = 5; a[n_] := a[n] = ((2*n^3 - 27*n^2 + 115*n - 150)*a[n - 3] + (2*n^3 - 23*n^2 + 85*n - 100)*a[n - 2] + 3*(2*n - 9)*a[n - 1])/(2*n - 9); Table[a[n], {n, 1, 23}]
    (* or: *)
    d[n_] := If[n < 0, 0, Subfactorial[n]]; Table[(n - 1)*(d[n - 4] + 2*d[n - 3] + d[n - 2]) + d[n - 2] + d[n - 1], {n, 1, 23}](* Jean-François Alcover, Nov 03 2016 *)
  • PARI
    d(n)=if(n>0, n!\/exp(1), n==0)
    a(n)=d(n-1) + d(n-2) + (n-1)*(d(n-2) + 2*d(n-3) + d(n-4)) \\ Charles R Greathouse IV, Nov 03 2016
Showing 1-1 of 1 results.