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

A001705 Generalized Stirling numbers: a(n) = n! * Sum_{k=0..n-1} (k+1)/(n-k).

Original entry on oeis.org

0, 1, 5, 26, 154, 1044, 8028, 69264, 663696, 6999840, 80627040, 1007441280, 13575738240, 196287356160, 3031488633600, 49811492505600, 867718162483200, 15974614352793600, 309920046408806400, 6320046028584960000, 135153868608460800000, 3024476051557847040000
Offset: 0

Views

Author

Keywords

Comments

a(n) is also the sum of the positions of the right-to-left minima in all permutations of [n]. Example: a(3)=26 because the positions of the right-to-left minima in the permutations 123,132,213,231,312 and 321 are 123, 13, 23, 3, 23 and 3, respectively and 1 + 2 + 3 + 1 + 3 + 2 + 3 + 3 + 2 + 3 + 3 = 26. - Emeric Deutsch, Sep 22 2008
The asymptotic expansion of the higher order exponential integral E(x,m=2,n=2) ~ exp(-x)/x^2*(1 - 5/x + 26/x^2 - 154/x^3 + 1044/x^4 - 8028/x^5 + 69264/x^6 - ...) leads to the sequence given above. See A163931 and A028421 for more information. - Johannes W. Meijer, Oct 20 2009
a(n) is the total number of cycles (excluding fixed points) in all permutations of [n+1]. - Olivier Gérard, Oct 23 2012; Dec 31 2012
A length n sequence is formed by randomly selecting (one-by-one) n real numbers in (0,1). a(n)/(n+1)! is the expected value of the sum of the new maximums in such a sequence. For example for n=3: If we select (in this order): 0.591996, 0.646474, 0.163659 we would add 0.591996 + 0.646474 which would be a bit above the average of a(3)/4! = 26/24. - Geoffrey Critzer, Oct 17 2013

Examples

			(1-x)^-2 * (-log(1-x)) = x + 5/2*x^2 + 13/3*x^3 + 77/12*x^4 + ...
Examples: a(6) = 6!*(1/6 + 2/5 + 3/4 + 4/3 + 5/2 + 6/1) = 8028; a(20) = 20!*(1/20 + 2/19 + 3/18 + 4/17 + 5/16 + ... + 16/5 + 17/4 + 18/3 + 19/2 + 20/1) = 135153868608460800000. - _Alexander Adamchuk_, Oct 09 2004
From _Olivier Gérard_, Dec 31 2012: (Start)
The cycle decomposition of all permutations of 4 elements gives the following list: {{{1},{2},{3},{4}}, {{1},{2},{3,4}}, {{1},{2,3},{4}}, {{1},{2,4,3}}, {{1},{2,3,4}}, {{1},{2,4},{3}}, {{1,2},{3},{4}}, {{1,2},{3,4}}, {{1,3,2},{4}},{{1,4,3,2}}, {{1,3,4,2}}, {{1,4,2},{3}}, {{1,2,3},{4}}, {{1,2,4,3}},{{1,3},{2},{4}}, {{1,4,3},{2}}, {{1,3},{2,4}}, {{1,4,2,3}}, {{1,2,3,4}}, {{1,2,4},{3}}, {{1,3,4},{2}}, {{1,4},{2},{3}}, {{1,3,2,4}}, {{1,4},{2,3}}}.
Deleting the fixed points gives the following 26 items: {{3,4}, {2,3}, {2,4,3}, {2,3,4}, {2,4}, {1,2}, {1,2}, {3,4}, {1,3,2}, {1,4,3,2}, {1,3,4,2}, {1,4,2}, {1,2,3}, {1,2,4,3}, {1,3}, {1,4,3}, {1,3}, {2,4}, {1,4,2,3}, {1,2,3,4}, {1,2,4}, {1,3,4}, {1,4}, {1,3,2,4}, {1,4}, {2,3}}. (End)
		

References

  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000254 (total number of cycles in permutations, including fixed points).
Cf. A002104 (number of different cycles in permutations, without fixed points).
Cf. A006231 (number of different cycles in permutations, including fixed points).
Related to n!*the k-th successive summation of the harmonic numbers:
(k=0) A000254, (k=1) A001705, (k=2) A001711, (k=3) A001716,
(k=4) A001721, (k=5) A051524, (k=6) A051545, (k=7) A051560,
(k=8) A051562, (k=9) A051564.

Programs

  • Maple
    a := n-> add((n+1)!/k, k=2..n+1): seq(a(n), n=0..21); # Zerinvary Lajos, Jan 22 2008; edited Johannes W. Meijer, Nov 28 2012
    a := n -> ((n+1)!*(h(n+1)-1)): h := n-> harmonic(n): seq(a(n), n=0..21); # Gary Detlefs, Dec 18 2009; corrected by Johannes W. Meijer, Nov 28 2012
  • Mathematica
    Table[n!*Sum[Sum[1/k,{k,1,m}], {m,1,n}], {n,0,20}] (* Alexander Adamchuk, Apr 14 2006 *)
    a[n_] := (n + 1)! (EulerGamma - 1 + PolyGamma[n + 2]);
    Table[a[n], {n, 0, 21}] (* Peter Luschny, Feb 19 2022 *)
  • Maxima
    a(n):=n!*sum(((-1)^(k+1)*binomial(n+1,k+1))/k,k,1,n); /* Vladimir Kruchinin, Oct 10 2016 */
    
  • PARI
    for(n=0,25, print1(n!*sum(k=0,n-1,(k+1)/(n-k)), ", ")) \\ G. C. Greubel, Jan 20 2017
    
  • Python
    from math import factorial
    def A001705(n):
        f = factorial(n)
        return sum(f*(k+1)//(n-k) for k in range(n)) # Chai Wah Wu, Jun 23 2022

Formula

Partial sum of first n harmonic numbers multiplied by n!.
a(n) = n!*Sum_{m=1..n} Sum_{k=1..m} 1/k = n!*Sum_{m=1..n} H(m), where H(m) = Sum_{k=1..m} 1/k = A001008(m)/A002805(m) is m-th Harmonic number.
E.g.f.: - log (1 - x) / (1 - x)^2.
a(n) = (n+1)! * H(n) - n*n!, H(n) = Sum_{k=1..n} (1/k).
a(n) = A112486(n, 1).
a(n) = a(n-1)*(n+1) + n! = A000254(n+1) - A000142(n+1) = A067176(n+1, 1). - Henry Bottomley, Jan 09 2002
a(n) = Sum_{k=0..n-1} ((-1)^(n-1+k) * (k+1) * 2^k * Stirling1(n, k+1)). - Borislav Crstici (bcrstici(AT)etv.utt.ro), Jan 26 2004
With alternating signs: Ramanujan polynomials psi_2(n, x) evaluated at 0. - Ralf Stephan, Apr 16 2004
a(n) = Sum_{k=1..n} (k*StirlingCycle(n+1,k+1)). - David Callan, Sep 25 2006
a(n) = Sum_{k=n..n*(n+1)/2} k*A143947(n,k). - Emeric Deutsch, Sep 22 2008
For n >= 1, a(n) = Sum_{j=0..n-1} ((-1)^(n-j-1) * 2^j * (j+1) * Stirling1(n,j+1)). - Milan Janjic, Dec 14 2008
a(n) = (2*n+1)*a(n-1) - n^2*a(n-2). - Gary Detlefs, Nov 27 2009
a(n) = (n+1)!*(H(n+1) - 1) where H(n) is the n-th harmonic number. - Gary Detlefs, Dec 18 2009
a(n) = n!*Sum_{k=1..n} (-1)^(k+1)*binomial(n+1,k+1)/k. - Vladimir Kruchinin, Oct 10 2016
a(n) = (n+1)!*Sum_{k = 1..n} (-1)^(k+1)*binomial(n+1,k+1)*k/(k+1). - Peter Bala, Feb 15 2022
a(n) = Gamma(n + 2) * (Digamma(n + 2) + EulerGamma - 1). - Peter Luschny, Feb 19 2022
From Mélika Tebni, Jun 22 2022: (Start)
a(n) = -Sum_{k=0..n} k!*A066667(n, k+1).
a(n) = Sum_{k=0..n} k!*A132159(n, k+1). (End)
a(n) = n*(n + 1)!*hypergeom([1, 1, 1 - n], [2, 3], 1)/2. - Peter Luschny, Jun 22 2022

Extensions

More terms from Sascha Kurz, Mar 22 2002

A143946 Triangle read by rows: T(n,k) is the number of permutations of [n] for which the sum of the positions of the left-to-right maxima is k (1 <= k <= n(n+1)/2).

Original entry on oeis.org

1, 1, 0, 1, 2, 0, 2, 1, 0, 1, 6, 0, 6, 3, 2, 3, 2, 1, 0, 1, 24, 0, 24, 12, 8, 18, 8, 10, 3, 6, 3, 2, 1, 0, 1, 120, 0, 120, 60, 40, 90, 64, 50, 39, 42, 23, 28, 13, 10, 8, 6, 3, 2, 1, 0, 1, 720, 0, 720, 360, 240, 540, 384, 420, 234, 372, 198, 208, 168, 124, 98, 75, 60, 35, 34, 13, 16, 8, 6, 3
Offset: 1

Views

Author

Emeric Deutsch, Sep 21 2008

Keywords

Comments

Row n contains n*(n+1)/2 = A000217(n) entries.
Sum of entries in row n = n! = A000142(n).

Examples

			T(4,6)=3 because we have 1243, 1342 and 2341 with left-to-right maxima at positions 1,2,3.
Triangle starts:
   1;
   1,  0,  1;
   2,  0,  2,  1,  0,  1;
   6,  0,  6,  3,  2,  3,  2,  1,  0,  1;
  24,  0, 24, 12,  8, 18,  8, 10,  3,  6,  3,  2,  1,  0,  1;
  ...
		

Crossrefs

T(n,n) gives A368246.

Programs

  • Maple
    P:=proc(n) options operator, arrow: sort(expand(product(t^j+j-1,j=1..n))) end proc: for n to 7 do seq(coeff(P(n),t,i),i=1..(1/2)*n*(n+1)) end do; # yields sequence in triangular form
    # second Maple program:
    b:= proc(n) option remember; `if`(n=0, 1,
          expand(b(n-1)*(x^n+n-1)))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..degree(p)))(b(n)):
    seq(T(n), n=1..7);  # Alois P. Heinz, Aug 05 2020
  • Mathematica
    row[n_] := CoefficientList[Product[t^k + k - 1, {k, 1, n}], t] // Rest;
    Array[row, 7] // Flatten (* Jean-François Alcover, Nov 28 2017 *)

Formula

T(n,1) = T(n,3) = (n-1)! for n>=2.
Sum_{k=1..n*(n+1)/2} k * T(n,k) = n! * n = A001563(n).
Generating polynomial of row n is t(t^2+1)(t^3+2)...(t^n+n-1).
Sum_{k=1..n*(n+1)/2} (n*(n+1)/2-k) * T(n,k) = A001804(n). - Alois P. Heinz, Dec 19 2023

A368678 Number of permutations of [n] whose cycle maxima sum to 2n.

Original entry on oeis.org

1, 0, 0, 1, 2, 10, 41, 260, 1552, 12818, 101280, 1021908, 10154064, 121656672, 1447205472, 20215013184, 280271024640, 4457067906240, 70826580095040, 1264147627392000, 22588177271650560, 448332829478760960, 8899910723677639680, 194096853444946636800
Offset: 0

Views

Author

Alois P. Heinz, Jan 02 2024

Keywords

Examples

			a(0) = 1: the empty permutation.
a(3) = 1: (1)(2)(3).
a(4) = 2: (1)(23)(4), (1)(24)(3).
a(5) = 10: (12)(3)(45), (13)(2)(45), (1)(234)(5), (1)(243)(5), (1)(235)(4),
  (1)(253)(4), (145)(2)(3), (154)(2)(3), (1)(24)(35), (1)(25)(34).
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember;
          `if`(n=0, 1, expand(b(n-1)*(t-n+x^n)))
        end:
    a:= n-> coeff(subs(t=n, b(n)), x, 2*n):
    seq(a(n), n=0..23);
  • Mathematica
    T[n_] := Module[{t}, CoefficientList[Product[n-k+t^k, {k, 1, n-1}]*t^(n-1), t]];
    a[n_] := Switch[n, 0, 1, 1|2, 0, _, T[n][[2 n]]];
    Table[a[n], {n, 0, 23}] (* Jean-François Alcover, Oct 03 2024 *)

Formula

a(n) = A143947(n,2n).

A369596 Number T(n,k) of permutations of [n] whose fixed points sum to k; triangle T(n,k), n>=0, 0<=k<=A000217(n), read by rows.

Original entry on oeis.org

1, 0, 1, 1, 0, 0, 1, 2, 1, 1, 1, 0, 0, 1, 9, 2, 2, 3, 3, 2, 1, 1, 0, 0, 1, 44, 9, 9, 11, 11, 13, 5, 5, 4, 4, 2, 1, 1, 0, 0, 1, 265, 44, 44, 53, 53, 62, 64, 29, 22, 24, 16, 16, 8, 6, 5, 4, 2, 1, 1, 0, 0, 1, 1854, 265, 265, 309, 309, 353, 362, 406, 150, 159, 126, 126, 93, 86, 44, 36, 29, 19, 19, 9, 7, 5, 4, 2, 1, 1, 0, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Mar 02 2024

Keywords

Examples

			T(3,0) = 2: 231, 312.
T(3,1) = 1: 132.
T(3,2) = 1: 321.
T(3,3) = 1: 213.
T(3,6) = 1: 123.
T(4,0) = 9: 2143, 2341, 2413, 3142, 3412, 3421, 4123, 4312, 4321.
Triangle T(n,k) begins:
   1;
   0, 1;
   1, 0, 0,  1;
   2, 1, 1,  1,  0,  0, 1;
   9, 2, 2,  3,  3,  2, 1, 1, 0, 0, 1;
  44, 9, 9, 11, 11, 13, 5, 5, 4, 4, 2, 1, 1, 0, 0, 1;
  ...
		

Crossrefs

Column k=0 gives A000166.
Column k=3 gives A000255(n-2) for n>=2.
Row sums give A000142.
Row lengths give A000124.
Reversed rows converge to A331518.
T(n,n) gives A369796.

Programs

  • Maple
    b:= proc(s) option remember; (n-> `if`(n=0, 1, add(expand(
          `if`(j=n, x^j, 1)*b(s minus {j})), j=s)))(nops(s))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b({$1..n})):
    seq(T(n), n=0..7);
    # second Maple program:
    g:= proc(n) option remember; `if`(n=0, 1, n*g(n-1)+(-1)^n) end:
    b:= proc(n, i, m) option remember; `if`(n>i*(i+1)/2, 0,
         `if`(n=0, g(m), b(n, i-1, m)+b(n-i, min(n-i, i-1), m-1)))
        end:
    T:= (n, k)-> b(k, min(n, k), n):
    seq(seq(T(n, k), k=0..n*(n+1)/2), n=0..7);
  • Mathematica
    g[n_] := g[n] = If[n == 0, 1, n*g[n - 1] + (-1)^n];
    b[n_, i_, m_] := b[n, i, m] = If[n > i*(i + 1)/2, 0,
       If[n == 0, g[m], b[n, i-1, m] + b[n-i, Min[n-i, i-1], m-1]]];
    T[n_, k_] := b[k, Min[n, k], n];
    Table[Table[T[n, k], {k, 0, n*(n + 1)/2}], {n, 0, 7}] // Flatten (* Jean-François Alcover, May 24 2024, after Alois P. Heinz *)

Formula

Sum_{k=0..A000217(n)} k * T(n,k) = A001710(n+1) for n >= 1.
Sum_{k=0..A000217(n)} (1+k) * T(n,k) = A038720(n) for n >= 1.
Sum_{k=0..A000217(n)} (n*(n+1)/2-k) * T(n,k) = A317527(n+1).
T(n,A161680(n)) = A331518(n).
T(n,A000217(n)) = 1.

A367594 Number of permutations of [n] whose cycle maxima sum to k, where k is chosen so as to maximize this number.

Original entry on oeis.org

1, 1, 1, 2, 7, 27, 142, 834, 5962, 46788, 426708, 4198632, 46516800, 551415936, 7197404976, 99712618560, 1500173940960, 23786129681280, 405087689727360, 7237524061198080, 137652562628778240, 2735042530132523520, 57482464477451489280, 1257272784581092070400
Offset: 0

Views

Author

Alois P. Heinz, Jan 03 2024

Keywords

Examples

			a(4) = 7 = A143947(4,7): (123)(4), (132)(4), (124)(3), (142)(3), (13)(24),
  (14)(23), (1)(2)(34).
a(5) = 27 = A143947(5,9): (1234)(5), (1243)(5), (1324)(5), (1342)(5), (1423)(5), (1432)(5), (1235)(4), (1253)(4), (1325)(4), (1352)(4), (1523)(4), (1532)(4), (124)(35), (142)(35), (125)(34), (152)(34), (134)(25), (143)(25), (135)(24), (153)(24), (14)(235), (14)(253), (15)(234), (15)(243), (1)(23)(45), (1)(245)(3), (1)(254)(3).
		

Crossrefs

Row maxima of A143947.
Cf. A368678.

Programs

  • Maple
    b:= proc(n) option remember;
          `if`(n=0, 1, expand(b(n-1)*(t-n+x^n)))
        end:
    a:= n-> max(coeffs(subs(t=n, b(n)))):
    seq(a(n), n=0..23);
  • Mathematica
    a[n_] := If[n == 0, 1, Module[{t}, CoefficientList[Product[n-k+t^k, {k, 1, n-1}]*t^(n-1), t] // Max]];
    Table[a[n], {n, 0, 23}] (* Jean-François Alcover, Oct 03 2024 *)

Formula

a(n) = A143947(n,2n-1) for n>=1, a(0) = 1.

A143948 Number of permutations of some {1,2,...,k} in which the sum of the positions of the right-to-left minima is n.

Original entry on oeis.org

1, 1, 1, 3, 7, 28, 130, 759, 5206, 41260, 369043, 3676429, 40334375, 483102302, 6271504796, 87706308280, 1314478069758, 21017345072301, 357096995609668, 6424807487105280, 122024726484398199, 2439707860612958618, 51219795310622022600, 1126569670246506800519
Offset: 0

Views

Author

Emeric Deutsch, Sep 22 2008

Keywords

Comments

Column sums of A143947.
Also the number of permutations of some [k] whose cycle maxima sum to n: a(4) = 7: (1)(23), (1234), (1243), (1324), (1342), (1423), (1432). - Alois P. Heinz, Jan 02 2024

Examples

			a(5) = 28 because we have 312, 213, 1342, 1432 and the 24 permutations of {1,2,3,4,5} that end with 1.
		

Crossrefs

Cf. A143947.

Programs

  • Maple
    g:=sum(product(j+x^(n-j),j=0..n-1),n=0..40): gser:=series(g,x=0,35): seq(coeff(gser,x,n),n=0..23);

Formula

G.f.: Sum_{n>=0} Product_{j=0..n-1} (j+x^(n-j)).
a(n) ~ (n-1)!. - Vaclav Kotesovec, Jun 12 2025

Extensions

a(0)=1 prepended by Alois P. Heinz, Jul 09 2023
Showing 1-6 of 6 results.