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

A052488 a(n) = floor(n*H(n)) where H(n) is the n-th harmonic number, Sum_{k=1..n} 1/k (A001008/A002805).

Original entry on oeis.org

1, 3, 5, 8, 11, 14, 18, 21, 25, 29, 33, 37, 41, 45, 49, 54, 58, 62, 67, 71, 76, 81, 85, 90, 95, 100, 105, 109, 114, 119, 124, 129, 134, 140, 145, 150, 155, 160, 165, 171, 176, 181, 187, 192, 197, 203, 208, 214, 219, 224, 230, 235, 241, 247, 252, 258, 263, 269
Offset: 1

Views

Author

Tomas Mario Kalmar (TomKalmar(AT)aol.com), Mar 15 2000

Keywords

Comments

Floor(n*H(n)) gives a (very) rough approximation to the n-th prime.
a(n) is the integer part of the solution to the Coupon Collector's Problem. For example, if there are n=4 different prizes to collect from cereal boxes and they are equally likely to be found, then the integer part of the average number of boxes to buy before the collection is complete is a(4)=8. - Ron Lalonde (ronronronlalonde(AT)hotmail.com), Feb 04 2004

References

  • John D. Barrow, One Hundred Essential Things You Didn't Know You Didn't Know, Ch. 3, 'On the Cards', W. W. Norton & Co., NY & London, 2008, pp. 30-32.

Crossrefs

Programs

  • Magma
    [Floor(n*HarmonicNumber(n)): n in [1..60]]; // G. C. Greubel, May 14 2019
    
  • Maple
    for n from 1 to 100 do printf(`%d,`,floor(n*sum(1/k, k=1..n))) od:
    # Alternatively:
    A052488:= n -> floor(n*(Psi(n+1)+gamma));
    seq(A052488(n),n=1..100); # Robert Israel, May 19 2014
  • Mathematica
    f[n_] := Floor[n*HarmonicNumber[n]]; Array[f, 60] (* Robert G. Wilson v, Nov 23 2015 *)
  • PARI
    a(n) = floor(n*sum(k=1, n, 1/k)) \\ Altug Alkan, Nov 23 2015
    
  • Python
    from math import floor
    n=100 #number of terms
    ans=0
    finalans = []
    for i in range(1, n+1):
        ans+=(1/i)
        finalans.append(floor(ans*i))
    print(finalans)
    # Adam Hugill, Feb 14 2022
    
  • Python
    from fractions import Fraction
    from itertools import count, islice
    def agen():
        Hn = 0
        for n in count(1):
            Hn += Fraction(1, n)
            yield (n*Hn.numerator)//Hn.denominator
    print(list(islice(agen(), 60))) # Michael S. Branicky, Aug 10 2022
    
  • Python
    from sympy import harmonic
    def A052488(n): return int(n*harmonic(n)) # Chai Wah Wu, Oct 24 2023
  • Sage
    [floor(n*harmonic_number(n)) for n in (1..60)] # G. C. Greubel, May 14 2019
    

Extensions

More terms from James Sellers, Mar 17 2000

A135736 Nearest integer to n*Sum_{k=1..n} 1/k = rounded expected coupon collection numbers.

Original entry on oeis.org

0, 1, 3, 6, 8, 11, 15, 18, 22, 25, 29, 33, 37, 41, 46, 50, 54, 58, 63, 67, 72, 77, 81, 86, 91, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 161, 166, 171, 176, 182, 187, 192, 198, 203, 209, 214, 219, 225, 230, 236, 242, 247, 253, 258, 264, 269, 275
Offset: 0

Views

Author

M. F. Hasler, Nov 29 2007

Keywords

Comments

Somewhat more realistic than A052488 but more optimistic than A060293, the expected number of boxes that must be bought to get the full collection of N objects, if each box contains any one of them at random. See also comments in A060293, A052488.

Examples

			a(0) = 0 since nothing needs to be bought if nothing is to be collected.
a(1) = 1 since only 1 box needs to be bought if only 1 object is to be collected.
a(2) = 3 since the chance of getting the other object at the second purchase is only 1/2, so it takes 2 boxes on the average to get it.
a(3) = 6 since the chance of getting a new object at the second purchase is 2/3 so it takes 3/2 boxes in the mean, then the chance becomes 1/3 to get the 3rd, i.e., 3 other boxes on the average to get the full collection and the rounded value of 1 + 3/2 + 3 = 11/2 = 5.5 is 6.
		

Crossrefs

Programs

  • Maple
    seq(round(n*harmonic(n)), n=1..100); # Robert Israel, Oct 31 2016
  • Mathematica
    Table[Round[n*Sum[1/k, {k, 1, n}]], {n,0,25}] (* G. C. Greubel, Oct 29 2016 *)
  • PARI
    A135736(n)=round(n*sum(i=1,n,1/i))
    
  • Python
    n=100 #set the number of terms you want to calculate here
    ans=0
    finalans = []
    finalans.append(0) #continuity with A135736
    for i in range(1, n+1):
        ans+=(1/i)
        finalans.append(int(round(ans*i)))
    print(finalans)
    # Adam Hugill, Feb 14 2022

Formula

a(n) = round(n*A001008(n)/A002805(n)) = either A052488(n) or A060293(n).
a(n) ~ A060293(n) ~ A052488(n) ~ A050502(n) ~ A050503(n) ~ A050504(n) (asymptotically)
Conjecture: a(n) = round(n*(log(n) + gamma) + 1/2) for n > 0, where gamma = A001620. - Ilya Gutkovskiy, Oct 31 2016
The conjecture is false: a(2416101) = 36905656 while round(2416101*(log(2416101) + gamma) + 1/2) = 36905657, with the unrounded numbers being 36905656.499999982... and 36905656.500000016.... Heuristically this should happen infinitely often. - Charles R Greathouse IV, Oct 31 2016

A071417 Triangle of expected coupon collection numbers rounded up; i.e., if aiming to collect part of a set of n coupons, the expected number of random coupons required to receive first the set with exactly k missing.

Original entry on oeis.org

0, 1, 0, 3, 1, 0, 6, 3, 1, 0, 9, 5, 3, 1, 0, 12, 7, 4, 3, 1, 0, 15, 9, 6, 4, 3, 1, 0, 19, 12, 8, 6, 4, 3, 1, 0, 22, 14, 10, 8, 6, 4, 3, 1, 0, 26, 17, 12, 9, 7, 5, 4, 3, 1, 0, 30, 20, 15, 11, 9, 7, 5, 4, 3, 1, 0, 34, 23, 17, 14, 11, 9, 7, 5, 4, 3, 1, 0, 38, 26, 20, 16, 13, 10, 8, 7, 5, 4, 3, 1, 0, 42
Offset: 0

Views

Author

Henry Bottomley, May 29 2002

Keywords

Examples

			Rows start
0;
1,0;
3,1,0;
6,3,1,0;
9,5,3,1,0;
etc.
		

Crossrefs

Cf. A060293 (left hand column), A067176.

Programs

  • Mathematica
    Table[Ceiling[n Sum[1/j, {j, k + 1, n}]], {n, 0, 12}, {k, 0, n}] // Flatten (* Michael De Vlieger, Jul 30 2017 *)

Formula

a(n, k) = ceiling(n*Sum_{j=k+1..n} 1/j) = ceiling(A067176(n, k)*k!/(n-1)!) = ceiling(A008279(n, n-k)*Sum_{j>=n-k} j*A008277(j-1, n-k-1)/n^j).

A085813 Number of cards that need to be drawn (with replacement) from a deck of n cards to have a 95% or greater chance of seeing each card at least once.

Original entry on oeis.org

1, 6, 11, 16, 21, 27, 33, 38, 44, 51, 57, 63, 70, 76, 83, 90, 96, 103, 110, 117, 124, 131, 138, 145, 152, 159, 167, 174, 181, 189, 196, 203, 211, 218, 226, 233, 241, 248, 256, 264, 271, 279, 287, 294, 302, 310, 318, 326, 333, 341, 349, 357, 365, 373, 381, 389
Offset: 1

Views

Author

Alfred Heiligenbrunner, Jul 25 2003

Keywords

Comments

The probability that there are at most k different cards in t drawings is (k/m)^t * binomial(m,k). This also includes the cases with k-1 different cards, which we want to subtract. Inclusion and exclusion leads to the formula Sum_{k=1..m} (-1)^(m-k) * (k/m)^t * binomial(m,k).

Examples

			a(2)=6 because you have to throw a coin 6 times to get both sides at least once with probability greater than or equal to 0.95. (The probability of getting only one side in a series of 6 throws is (1/2)^6 * 2 = 1/32 = 0.03125 < 0.05.)
a(6)=27 because you have to roll a die 27 times to see all 6 possible outcomes with a probability over 0.95. (If you roll a die 27 times, the probability of getting all 6 sides at least once is 0.95658638... . If you roll the die only 26 times, the probability is 0.94798274... .)
		

Crossrefs

Cf. A073593 (number of drawings for a 50% probability of seeing each card, = median) and A060293 (expected value of the number of drawings until each card is drawn once).
Cf. A090582.

Programs

  • Mathematica
    f[1] = 1; f[n_] := f[n] = Block[{k = f[n - 1]}, While[ 2StirlingS2[k, n]*n!/n^k < 19/10, k++ ]; k]; Table[ f[n], {n, 1, 56}]

Extensions

More terms from Robert G. Wilson v, Sep 07 2003
Showing 1-4 of 4 results.