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.

A136128 Number of components in all permutations of [1,2,...,n].

Original entry on oeis.org

1, 3, 10, 40, 192, 1092, 7248, 55296, 478080, 4625280, 49524480, 581368320, 7422589440, 102372076800, 1516402944000, 24004657152000, 404347023360000, 7220327288832000, 136227009945600000, 2707657158721536000, 56546150835879936000, 1237826569587277824000
Offset: 1

Views

Author

Emeric Deutsch, Jan 21 2008

Keywords

Examples

			a(3) = 10 because the permutations of [1,2,3], with components separated by /, are 1/2/3, 1/32, 21/3, 231, 312 and 321.
		

References

  • Louis Comtet, Advanced Combinatorics, Reidel, 1974, p. 262 (#14).

Crossrefs

Programs

  • Maple
    seq(add(factorial(i)*factorial(n-i),i=0..n-1),n=1..20);
    # second Maple program:
    a:= proc(n) option remember; `if`(n<2, n,
          (a(n-1)+(n-1)!)*(n+1)/2)
        end:
    seq(a(n), n=1..23);  # Alois P. Heinz, Jun 13 2019
  • Mathematica
    nn=20; p=Sum[n!x^n,{n,0,nn}]; Drop[CoefficientList[Series[p(p-1), {x,0,nn}], x], 1] (* Geoffrey Critzer, Apr 20 2012 *)
    Table[(n + 1)! Re[-LerchPhi[2, 1, n + 1]], {n, 1, 20}]  (* Peter Luschny, Jan 04 2018 *)
  • PARI
    a(n) = 2*sum(k=0, (n+1)\2, (4^k-1)*abs(stirling(n+1, 2*k, 1))*bernfrac(2*k)); \\ Seiichi Manyama, Oct 05 2022
    
  • PARI
    a(n) = my(A = 1, B = 1); for(k=1, n, B *= k; A = (n-k+1)*A + B); A-B \\ Mikhail Kurkov, Aug 09 2025
    
  • Python
    def aList(n) -> list[int]:
        f, al, A = 1, 1, [1]
        for i in range(2, n + 1):
            f, al = f * i, (al + f) * (i + 1) >> 1
            A.append(al)
        return A
    print(aList(22))  # Peter Luschny, Aug 09 2025

Formula

a(n) = A003149(n) - n!.
a(n) = A059371(n) + n! (n>=2).
a(n) = Sum_{k=1..n} k*A059438(n,k).
a(n) = Sum_{i=0..n-1} i!*(n-i)!.
a(n) = (n+1)!*(1 + Sum_{j=1..n-1} 2^j/(j+1))/2^n.
a(n) = (n+1)*a(n-1)/2 + (n-1)!*(n+1)/2, a(1)=1.
G.f.: f(f-1), where f(x) = Sum_{j>=0} j!*x^j.
a(n) = (n + 1)!*Re(-LerchPhi(2, 1, n + 1)). - Peter Luschny, Jan 04 2018
D-finite with recurrence: 2*a(n) +(-3*n+1)*a(n-1) +(n^2-3*n+4)*a(n-2) +(n-1)*(n-2)*a(n-3)=0. - R. J. Mathar, Jul 26 2022
a(n) = 2 * Sum_{k=0..floor((n+1)/2)} (4^k-1) * |Stirling1(n+1,2*k)| * Bernoulli(2*k). - Seiichi Manyama, Oct 05 2022
E.g.f.: x/((2-x)*(1-x)) - 2*log(1-x)/((2-x)^2). - Vladimir Kruchinin, Nov 16 2022