login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306150 Row sums of A306015. 2
0, 2, 4, 14, 56, 282, 1692, 11846, 94768, 852914, 8529140, 93820542, 1125846504, 14636004554, 204904063756, 3073560956342, 49176975301472, 836008580125026, 15048154442250468, 285914934402758894, 5718298688055177880, 120084272449158735482, 2641853993881492180604 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
a(n) is the number of nonderangements of size n in which each fixed point is colored red or blue. For example, with n = 3, the derangements are 231 and 312 and they don't count, the permutations 132, 321, 213 each have 1 fixed point and hence 2 colorings, and the identity 123 with 3 fixed points has 8 colorings, yielding a(3) = 3*2 + 8 = 14 colorings altogether. - David Callan, Dec 19 2021
LINKS
FORMULA
a(n) = e * Gamma(n + 1, 1) - !(n).
a(n) = Gamma(n + 1, 1) * e - Gamma(n + 1, -1) / e.
a(n) = n*a(n-1) + a(n-2) - (n-2)*a(n-3) for n >= 3.
a(n) = n! [x^n] 2*sinh(x)/(1-x).
a(n) = 2*A186763(n) = (-1)^(n+1)*2*A009628(n) = A000522(n) - A000166(n).
MAPLE
egf := 2*sinh(x)/(1-x): ser := series(egf, x, 24):
seq(n!*coeff(ser, x, n), n=0..22);
MATHEMATICA
Table[Exp[1] Gamma[n+1, 1] - Subfactorial[n], {n, 0, 22}]
With[{nmax = 50}, CoefficientList[Series[2*Sinh[x]/(1 - x), {x, 0, nmax}], x]*Range[0, nmax]!] (* G. C. Greubel, Jul 18 2018 *)
PROG
(Sage)
@cached_function
def a(n):
if n<3: return 2*n
return n*a(n-1)+a(n-2)-(n-2)*a(n-3)
[a(n) for n in (0..22)]
(PARI) x='x+O('x^30); concat([0], Vec(serlaplace(2*sinh(x)/(1 - x)))) \\ G. C. Greubel, Jul 18 2018
(Magma) m:=30; R<x>:=PowerSeriesRing(Rationals(), m); b:= [0] cat Coefficients(R!(2*Sinh(x)/(1-x))); [Factorial(n-1)*b[n]: n in [1..m]]; // G. C. Greubel, Jul 18 2018
CROSSREFS
Cf. A306015.
Sequence in context: A367558 A109154 A030853 * A030962 A030830 A059687
KEYWORD
nonn
AUTHOR
Peter Luschny, Jun 23 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 25 14:22 EDT 2024. Contains 374609 sequences. (Running on oeis4.)