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.

A033810 Number of people needed so that probability of at least two sharing a birthday out of n possible days is at least 50%.

Original entry on oeis.org

2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12
Offset: 1

Views

Author

Keywords

Comments

a(365) = 23 is the solution to the Birthday Problem.

Crossrefs

Essentially the same as A088141. See also A182008, A182009, A182010.
Cf. A014088 (n people on 365 days), A225852 (3 on n days), A225871 (4 people on n days).
Cf. A380129 (Strong Birthday Problem).

Programs

  • Mathematica
    lst = {}; s = 1; Do[Do[If[Product[(n - i + 1)/n, {i, j}] <= 1/2, If[j > s, s = j]; AppendTo[lst, j]; Break[]], {j, s, s + 1}], {n, 86}]; lst (* Arkadiusz Wesolowski, Apr 29 2012 *)
    A033810[n_] := Catch@Do[If[1/2 >= n!/(n - m)!/n^m, Throw[m]], {m, 2, Infinity}]; Array[A033810, 86] (* JungHwan Min, Mar 27 2017 *)
  • Python
    from math import comb, factorial
    def A033810(n):
        def p(m): return comb(n,m)*factorial(m)<<1
        kmin, kmax = 0, 1
        while p(kmax) > n**kmax: kmax<<=1
        while kmax-kmin > 1:
            kmid = kmax+kmin>>1
            if p(kmid) <= n**kmid:
                kmax = kmid
            else:
                kmin = kmid
        return kmax # Chai Wah Wu, Jan 21 2025

Formula

a(n) = ceiling(sqrt(2*n*log(2)) + (3 - 2*log(2))/6 + (9 - 4*log(2)^2) / (72*sqrt(2*n*log(2))) - 2*log(2)^2/(135*n)) for all n up to 10^18. It is conjectured that this formula holds for all n.