A096620 Denominator of -3*n + 2*(1+n)*HarmonicNumber(n).
1, 1, 1, 3, 6, 5, 10, 35, 140, 126, 1260, 1155, 13860, 12870, 12012, 45045, 360360, 340340, 2042040, 1939938, 369512, 117572, 2586584, 7436429, 178474296, 171609900, 1487285800, 1434168450, 40156716600, 38818159380, 1164544781400, 4512611027925, 2187932619600
Offset: 0
Examples
Extended by _Petros Hadjicostas_, Oct 25 2019: (Start) fr_1(n) = 0, 1, 3, 17/3, 53/6, 62/5, 163/10, 717/35, 3489/140, ... = -3*n + 2*(1+n)*HarmonicNumber(n) = A093418(n)/a(n) = A288964(n)/n! + n (Havil's recurrence, which is related to Knuth's recurrence--see comments above). fr_2(n) = 0, 0, 1, 8/3, 29/6, 37/5, 103/10, 472/35, 2369/140, ... = -4*n + 2*(1+n)*HarmonicNumber(n) = A115107(n)/a(n) = A288964/n! (Cameron's recurrence, which is the same as Kauers and Paule's recurrence--see comments above). Both fr_1(n) and fr_2(n) are equal to the average time to quicksort n items in random order but under slightly different assumptions. (End)
References
- Peter J. Cameron, Combinatorics: Topics, Techniques and Algorithms, Cambridge Univ. Press, 1996; see pp. 66-68.
- J. H. Conway and R. K. Guy, The Book of Numbers. New York: Springer-Verlag, 1996, pp. 143 and 258-259.
- Julian Havil, Gamma: Exploring Euler's constant, Princeton University Press, 2003; see pp. 128-130.
- D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, 1998; see pp. 427-431 and 454-455.
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- S. B. Ekhad and D. Zeilberger, A detailed analysis of quicksort running time, arXiv:1903.03708 [math.PR], 2019. [They have the recurrence with n-1, rather than n, from which they get -4*n + 2*(1+n)*HarmonicNumber(n) for the average number of comparisons.]
- M. Kauers and P. Paule, The Concrete Tetrahedron, Springer, 2011; see p. 4. [They agree with Cameron's recurrence that yields numerators in A115107 and denominators in this sequence.]
- Eric Weisstein's World of Mathematics, Quicksort. [He uses Havil's recurrence which yields numerators in sequence A093418 and denominators in this sequence.]
- Eric Weisstein's World of Mathematics, Harmonic Number.
- Wikipedia, Quicksort. [The article uses Cameron's recurrence which yields numerators in A115107 and denominators in this sequence.]
Crossrefs
Programs
-
Magma
[Denominator(2*(n+1)*HarmonicNumber(n+1) -1): n in [0..50]]; // G. C. Greubel, Sep 01 2018
-
Mathematica
Denominator[Table[2*(n + 1)*HarmonicNumber[n + 1] - 1, {n, 0, 50}]] (* G. C. Greubel, Sep 01 2018 *)
-
PARI
{h(n) = sum(k=1,n,1/k)}; for(n=0,50, print1(denominator(2*(n+1)*h(n+1) -1), ", ")) \\ G. C. Greubel, Sep 01 2018
-
Python
from fractions import Fraction from itertools import count, islice def agen(): # generator of terms Hn = Fraction(0, 1) for n in count(0): yield (-3*n + 2*(1+n)*Hn).denominator Hn += Fraction(1, n+1) print(list(islice(agen(), 30))) # Michael S. Branicky, Apr 17 2022
Formula
a(n) = Denominator(2*(n+1)*HarmonicNumber(n+1)-1). - Gary Detlefs, Sep 14 2011
a(n) = Denominator((H(n+1) + H(n))/(H(n+1) - H(n))), where H(n) is the n-th harmonic number. - Gary Detlefs, Oct 03 2011
From Petros Hadjicostas, Oct 25 2019: (Start)
G.f. for fr_1(n) = E(X_n): -(x + 2*log(1-x))/(1-x)^2 (due to Vladeta Jovovic, Jul 05 2004).
G.f. for fr_2(n) = E(Y_n): -2*(x + log(1-x))/(1-x)^2 (Cameron (1996), p. 68). (End)
Extensions
Offset corrected by Gary Detlefs, Sep 14 2011
Comments