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

A151881 Sum (number of cycles)^2 over all n! permutations of [1..n].

Original entry on oeis.org

1, 5, 23, 120, 724, 5012, 39332, 345832, 3371976, 36135792, 422379792, 5349561984, 72996193152, 1067779243008, 16670798231040, 276718772067840, 4866610479828480, 90401487246167040, 1768784607499944960, 36360467544043008000, 783508616506603008000
Offset: 1

Views

Author

N. J. A. Sloane, Jul 22 2009

Keywords

Comments

Sum (number of cycles) over all n! permutations of [1..n] gives A000254.
a(n) equals -1 times the coefficient of x of the characteristic polynomial of the n X n matrix whose (i,j)-entry is equal to i+1 if i=j, and is equal to 1 otherwise. [John M. Campbell, May 24 2011]

Crossrefs

Programs

  • Maple
    with(combinat): with(numtheory):
    M:=30;
    for n from 1 to M do
        p:=partition(n); s:=0:
        for k from 1 to nops(p) do
            # get next partition of n
            # convert partition to list of sizes of parts
            q:=convert(p[k], multiset);
            for i from 1 to n do a(i):=0: od:
            for i from 1 to nops(q) do a(q[i][1]):=q[i][2]: od:
            # get number of parts:
            nump := add(a(i), i=1..n);
            # get multiplicity:
            c:=1: for i from 1 to n do c:=c*a(i)!*i^a(i): od:
            prop:=nump^2;
            s:=s + (n!/c)*prop;
        od;
        lprint(n, s);
        A[n]:=s;
    od:
    [seq(A[n], n=1..M)];
    # Alternatively after Reshetnikov:
    a := n -> n!*(add(1/k,k=1..n)^2 + add(1/k-1/k^2,k=1..n)):
    seq(a(n), n=1..19); # Peter Luschny, Oct 21 2015
  • Mathematica
    Table[-Coefficient[CharacteristicPolynomial[ Array[KroneckerDelta[#1, #2]((((#1+1)))-1)+1&,{n,n}],x],x], {n,1,10}] (* John M. Campbell, May 24 2011 *)
    Table[n! (HarmonicNumber[n] + HarmonicNumber[n]^2 - HarmonicNumber[n, 2]), {n, 1, 20}] (* Vladimir Reshetnikov, Oct 20 2015 *)

Formula

a(n) = (-1)^(n+1)*(Stirling1(n+1,2)-2*Stirling1(n+1,3)). - Vladeta Jovovic, Jul 22 2009
a(n) = n!*(H(n)+H(n)^2-H2(n)), where H(n)=sum(k=1..n,1/k), H2(n)=sum(k=1..n,1/k^2). - Vladimir Reshetnikov, Oct 20 2015
E.g.f.: (log(1-x)^2-log(1-x))/(1-x). - Vladimir Reshetnikov, Oct 20 2015
a(n) = Sum_{k=0..n} |Stirling1(n,k)|*k^2. - Peter Luschny, Jan 14 2020

A151883 Let g be a permutation of [1..n] having say j_i cycles of length i, with Sum_i i*j_i = n; sequence gives Sum_g Sum_{i even} (j_i)^2.

Original entry on oeis.org

0, 1, 3, 24, 120, 840, 5880, 54600, 491400, 5276880, 58045680, 749770560, 9747017280, 142685262720, 2140278940800, 35879056012800, 609943952217600, 11334678568012800, 215358892792243200, 4453151976335462400, 93516191503044710400, 2108447155238693068800
Offset: 1

Views

Author

N. J. A. Sloane, Jul 22 2009

Keywords

Crossrefs

Programs

  • Maple
    with(combinat):
    b:= proc(n, i) option remember; `if`(n=0, [1,0], `if`(i<1, 0,
          add(multinomial(n,n-i*j,i$j)/j!*(i-1)!^j*(p-> p+
          `if`(i::even, [0, p[1]*j^2], 0))(b(n-i*j, i-1)), j=0..n/i)))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=1..30);  # Alois P. Heinz, Oct 21 2015
  • Mathematica
    multinomial[n_, k_] := n!/Times @@ (k!); b[n_, i_] := b[n, i] = If[n==0, {1, 0}, If[i<1, {0, 0}, Sum[multinomial[n, Join[{n-i*j}, Array[i&, j]]]/j! * (i-1)!^j * Function[p, p+If[EvenQ[i], {0, p[[1]]*j^2}, {0, 0}]][b[n-i*j, i-1]], {j, 0, n/i}]]]; a[n_] := b[n, n][[2]]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Mar 13 2017, after Alois P. Heinz *)

A151884 Let g be a permutation of [1..n] having say j_i cycles of length i, with Sum_i i*j_i = n; sequence gives Sum_g Sum_{i odd} (j_i)^2.

Original entry on oeis.org

1, 4, 14, 56, 304, 1904, 14048, 112384, 1051776, 10662912, 120920832, 1451049984, 19342651392, 272576268288, 4175822315520, 66813157048320, 1156746459709440, 20900477925457920, 403511454289428480, 8070229085788569600, 171907712809736601600
Offset: 1

Views

Author

N. J. A. Sloane, Jul 22 2009

Keywords

Crossrefs

Programs

  • Maple
    with(combinat):
    b:= proc(n, i) option remember; `if`(n=0, [1,0], `if`(i<1, 0,
          add(multinomial(n,n-i*j,i$j)/j!*(i-1)!^j*(p-> p+
          `if`(i::odd, [0, p[1]*j^2], 0))(b(n-i*j, i-1)), j=0..n/i)))
        end:
    a:= n-> b(n$2)[2]:
    seq(a(n), n=1..30);  # Alois P. Heinz, Oct 21 2015
  • Mathematica
    multinomial[n_, k_List] := n!/Times @@ (k!); b[n_, i_] := b[n, i] = If[n==0, {1, 0}, If[i<1, {0, 0}, Sum[multinomial[n, Join[{n-i*j}, Array[i&, j]]]/j!*(i-1)!^j*Function[p, p+If[OddQ[i], {0, p[[1]]*j^2}, {0, 0}]][b[n-i*j, i-1]], {j, 0, n/i}]]]; a[n_] := b[n, n][[2]]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Mar 13 2017, after Alois P. Heinz *)
Showing 1-3 of 3 results.