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.

A334716 a(n) = !n + n * n!, where !n = A000166(n) is subfactorial of n.

This page as a plain text file.
%I A334716 #25 Apr 26 2021 07:32:15
%S A334716 1,1,5,20,105,644,4585,37134,337393,3399416,37622961,453769370,
%T A334716 5924234041,83242063332,1252567177849,20096182035734,342461702459745,
%U A334716 6177536369911664,117598028364137953,2356007639327453106,49553054794725702121,1091705092860949184540
%N A334716 a(n) = !n + n * n!, where !n = A000166(n) is subfactorial of n.
%H A334716 Alois P. Heinz, <a href="/A334716/b334716.txt">Table of n, a(n) for n = 0..448</a>
%H A334716 Wikipedia, <a href="https://en.wikipedia.org/wiki/Derangement">Derangement</a>
%F A334716 E.g.f.: x/(x-1)^2 - exp(-x)/(x-1).
%F A334716 a(n) = A000166(n) + A001563(n) = !n + n * n!.
%p A334716 a:= proc(n) option remember; `if`(n<3, [1, 1, 5][n+1],
%p A334716       ((2*n+1)*(n-1)*a(n-1)-(n-1)*(n^2-2*n-2)*a(n-2)
%p A334716        -(n+1)*(n-1)*(n-2)*a(n-3))/n)
%p A334716     end:
%p A334716 seq(a(n), n=0..23);
%t A334716 a[n_] := Subfactorial[n] + n n!;
%t A334716 a /@ Range[0, 23] (* _Jean-François Alcover_, Apr 26 2021 *)
%Y A334716 Main diagonal of A334715.
%Y A334716 Cf. A000142, A000166, A001563.
%K A334716 nonn
%O A334716 0,3
%A A334716 _Alois P. Heinz_, May 08 2020