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.

A060293 Expected coupon collection numbers rounded up; i.e., if aiming to collect a set of n coupons, the expected number of random coupons required to receive the full set.

Original entry on oeis.org

0, 1, 3, 6, 9, 12, 15, 19, 22, 26, 30, 34, 38, 42, 46, 50, 55, 59, 63, 68, 72, 77, 82, 86, 91, 96, 101, 106, 110, 115, 120, 125, 130, 135, 141, 146, 151, 156, 161, 166, 172, 177, 182, 188, 193, 198, 204, 209, 215, 220, 225, 231, 236, 242, 248, 253, 259, 264, 270
Offset: 0

Views

Author

Henry Bottomley, Mar 24 2001

Keywords

Examples

			a(2)=3 since the probability of getting both coupons after two is 1/2, after 3 is 1/4, after 4 is 1/8, etc. and 2/2 + 3/2^2 + 4/2^3 + ... = 3.
		

Crossrefs

Cf. A052488.

Programs

  • Maple
    H := proc(n)
        add(1/k,k=1..n) ;
    end proc:
    A060293 := proc(n)
        ceil(n*H(n)) ;
    end proc: # R. J. Mathar, Aug 02 2009, Dec 02 2016
    A060293:= n -> ceil(Psi(n+1)+gamma); # Robert Israel, May 19 2014
  • Mathematica
    f[n_] := Ceiling[n*HarmonicNumber[n]]; Array[f, 60, 0] (* Robert G. Wilson v, Nov 23 2015 *)
  • PARI
    vector(100, n, n--; ceil(n*sum(k=1, n, 1/k))) \\ Altug Alkan, Nov 23 2015
    
  • Python
    from math import ceil
    n=100 #number of terms
    ans=0
    finalans = [0]
    for i in range(1, n+1):
        ans+=(1/i)
        finalans.append(ceil(ans*i))
    print(finalans)
    # Adam Hugill, Feb 14 2022

Formula

a(n) = ceiling(n*Sum_{k=1..n}(1/k)) = ceiling(n*A001008(n)/A002805(n)) = A052488(n) + 1 for n>2.