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.

A306150 Row sums of A306015.

Original entry on oeis.org

0, 2, 4, 14, 56, 282, 1692, 11846, 94768, 852914, 8529140, 93820542, 1125846504, 14636004554, 204904063756, 3073560956342, 49176975301472, 836008580125026, 15048154442250468, 285914934402758894, 5718298688055177880, 120084272449158735482, 2641853993881492180604
Offset: 0

Views

Author

Peter Luschny, Jun 23 2018

Keywords

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

Crossrefs

Programs

  • Magma
    m:=30; R:=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
  • 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 *)
  • PARI
    x='x+O('x^30); concat([0], Vec(serlaplace(2*sinh(x)/(1 - x)))) \\ G. C. Greubel, Jul 18 2018
    
  • 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)]
    

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).