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-10 of 13 results. Next

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.

A225852 The number of people required for there to be at least a 50% chance that at least 3 share a birthday in a year with n days.

Original entry on oeis.org

3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30
Offset: 1

Views

Author

Keywords

Comments

a(365) = 88.
For n <= 1000, a(n) = 1.436 + 1.812*n^0.654 - 0.817/n^3 provides an estimate accurate to 0.6 units.

Examples

			The probability that out of 87 people 3 share a birthday in a year with 365 days is 0.4994549. The corresponding probability for 88 people is 0.5110651. Therefore a(365)=88.
		

Crossrefs

Cf. A014088 (n people on 365 days), A033810 (2 people on n days), A225871 (4 people on n days).

Programs

  • R
    library(gmp);#prob of a maximum of exactly k coincident birthdays is
    BigQ<-function(nday,p,k) { #nday=days in a year; p=people
        if(p1,sum(sapply(2:k-1,function(j) BigQ(nday-i,p-k*i,j))),1)
        }
        tot
    }
    BDaySharedByAtLeast<-function(nday,people,k) {
        if(nday<1 | people
    				

A050255 A Diaconis-Mosteller approximation to the Birthday problem function.

Original entry on oeis.org

1, 23, 88, 187, 313, 459, 622, 797, 983, 1179, 1382, 1592, 1809, 2031, 2257, 2489, 2724, 2963, 3205, 3450, 3698, 3949, 4203, 4459, 4717, 4977, 5239, 5503, 5768, 6036, 6305, 6575, 6847, 7121, 7395, 7671, 7948, 8227, 8506, 8787, 9068, 9351, 9634, 9919, 10204
Offset: 1

Views

Author

Keywords

Comments

Comment from Stig Blücher Brink, May 18 2023: (Start)
Maximum relative approximation error for a(1) to a(10000) is 0.27%.
Maximum absolute approximation error for a(1) to a(10000) is 2126.
(End)

Crossrefs

Programs

  • Mathematica
    a[n_]:=Ceiling[x /. N[Solve[x Exp[-x/(365 n)]==(365^(n-1) n! Log[2] (1-x/(365 (n+1))))^(1/n), x, Reals]]]; Flatten[Table[a[n], {n, 15}]] (* Iain Fox, Oct 26 2018 *)

Formula

a(n) is ceiling(x), where x is the real solution to x*exp(-x/(365*n)) = (log(2)*365^(n-1)*n!*(1 - x/(365*(n+1))))^(1/n). - Iain Fox, Oct 26 2018

Extensions

a(43)-a(45) from Alois P. Heinz, May 17 2023

A225871 Number of people required for there to be a 50% probability that at least 4 share a birthday in a year with n days.

Original entry on oeis.org

4, 6, 7, 9, 10, 11, 12, 13, 15, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 25, 25, 26, 27, 28, 28, 29, 30, 31, 32, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, 41, 41, 42, 43, 43, 44, 45, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 51, 52, 53, 53, 54, 54, 55, 56
Offset: 1

Views

Author

Keywords

Comments

a(365)=187.
For n<1000, the formula a(n) = 2.79 + 2.456*n^0.732 - 1.825/n provides an estimate of a(n) accurate to 0.82.

Examples

			For a year with 365 days, a(365), the probability that out of 186 people 4 of them share a birthday is 0.495825. The corresponding probability for 187 people is 0.502685, and therefore a(365)=187.
		

Crossrefs

Cf. A014088 (n people on 365 days), A033810 (2 people on n days), A225852 (3 on n days).

Programs

  • R
    library(gmp);#prob of a maximum of exactly k coincident birthdays is
    BigQ<-function(nday,p,k) { #nday=days in a year; p=people
        if(p1,sum(sapply(2:k-1,function(j) BigQ(nday-i,p-k*i,j))),1)
        }
        tot
    }
    BDaySharedByAtLeast<-function(nday,people,k) {
        if(nday<1 | people
    				

A091673 Numerator Q of probability P = Q(n)/365^(n-1) that exactly two out of n people share the same birthday.

Original entry on oeis.org

1, 1092, 793884, 480299820, 261163522620, 132358677731280, 63798093049771080, 29612552769907347240, 13345042642324219106280, 5872442544965392834838400, 2533775368098060137659608000, 1075256447734638237381213700800
Offset: 2

Views

Author

Hugo Pfoertner, Feb 03 2004

Keywords

Comments

A 365-day year and a uniform distribution of birthdays throughout the year are assumed.

Examples

			a(3)=1092 because the probability that in a group of 3 people exactly two of them share the same birthday is (1/365^3)*3!*binomial(365,1)*binomial(364,1)/2 = (1/365^2)*3*364 = (1/365^2)*1092.
		

Crossrefs

Cf. A014088, A091674 gives probabilities for two or more coincidences, A091715 gives probabilities for three or more coincidences.

Programs

  • Mathematica
    P[n_] := (n! Sum[ Binomial[365, i]*Binomial[365 - i, n - 2i] /2^i, {i, 1, Floor[n/2]}]/365); Table[ P[n], {n, 2, 13}] (* Robert G. Wilson v, Feb 09 2004 *)
  • Python
    from math import factorial, comb
    from fractions import Fraction
    def A091673(n): return int(factorial(n)*sum(Fraction(comb(365,i)*comb(365-i,n-(i<<1)),365<>1)+1))) # Chai Wah Wu, Jan 22 2025

Formula

P(n) = n!*Sum_{i=1..floor(n/2)} binomial(365, i)*binomial(365-i, n-2*i)/2^i.

Extensions

More terms from Robert G. Wilson v, Feb 09 2004

A091674 Numerator Q of probability P = Q(n)/365^(n-1) that two or more out of n people share the same birthday.

Original entry on oeis.org

1, 1093, 795341, 481626601, 262130079485, 132974790903865, 64157156143943045, 29808728817823292065, 13447118719710220490765, 5923562823392985950002825, 2558600264156303883127171925, 1087010123072386037371040127025
Offset: 2

Views

Author

Hugo Pfoertner, Feb 03 2004

Keywords

Comments

A 365-day year and a uniform distribution of birthdays throughout the year are assumed.

Crossrefs

Cf. A014088, A091673 (probabilities for exactly two), A091715 (probabilities for three or more).

Programs

  • Mathematica
    Q[n_] := (1 - Product[(1 - i/365), {i, 1, n - 1}])365^(n - 1); Table[ Q[n], {n, 2, 13}] (* Robert G. Wilson v, Feb 05 2004 *)
  • Python
    from math import prod
    def A091674(n): return 365**(n-1)-prod(365-i for i in range(1,n)) # Chai Wah Wu, Jan 22 2025

Formula

Q(n) = (1 - Product_{i=1..n-1} (1-i/365))*365^(n-1).

Extensions

More terms from Robert G. Wilson v, Feb 05 2004

A050256 a(n) = floor(47*(n-3/2)^(3/2)).

Original entry on oeis.org

16, 86, 185, 307, 448, 606, 778, 965, 1164, 1376, 1599, 1832, 2077, 2331, 2595, 2868, 3150, 3440, 3739, 4047, 4362, 4685, 5016, 5354, 5699, 6052, 6411, 6777, 7150, 7530, 7916, 8309, 8708, 9113, 9524, 9941, 10364, 10793, 11227, 11667, 12113, 12565, 13022, 13484
Offset: 2

Views

Author

Keywords

Comments

Mentioned in the Diaconis-Mosteller article.

Crossrefs

Programs

  • Maple
    a:= n-> floor(47*(n-3/2)^(3/2)):
    seq(a(n), n=2..55);  # Alois P. Heinz, May 17 2023
  • PARI
    vector(50,n,n++;floor(47*(n-1.5)^(3/2))) \\ Derek Orr, Sep 05 2015
    
  • PARI
    a(n) = floor(47*(n-1.5)^1.5) \\ Charles R Greathouse IV, Sep 05 2015

Extensions

First term removed by Derek Orr, Sep 05 2015
Offset corrected by Iain Fox, Nov 16 2017
Entry revised by N. J. A. Sloane, Jun 21 2023

A091715 Numerator Q of probability P = Q(n)/365^(n-1) that three or more out of n people share the same birthday.

Original entry on oeis.org

1, 1457, 1326781, 966556865, 616113172585, 359063094171965, 196176047915944825, 102076077386001384485, 51120278427593115164425, 24824896058243745467563925, 11753675337747799989826426225
Offset: 3

Views

Author

Hugo Pfoertner, Feb 04 2004

Keywords

Comments

A 365-day year and a uniform distribution of birthdays throughout the year are assumed. The probability that 3 or more out of n people share a birthday equals the probability A091674(n)/365^(n-1) that 2 or more share a birthday minus the probability A091673(n)/365^(n-1) that exactly 2 share a birthday.

Examples

			The probability that 3 or more people in a group of 10 share the same birthday is a(10)/365^9 = 102076077386001384485/114983567789585767578125 ~= 8.87744913*10^-4.
The probability exceeds 50% for n > A014088(3) = 88.
		

Crossrefs

Cf. A014088, A091673 (probabilities for exactly two), A091674 (probabilities for two or more).

Formula

a(n) = A091674(n) - A091673(n).

A380129 Strong Birthday Problem: Number of people needed so that probability of everyone sharing a birthday out of n possible days is at least 1/2.

Original entry on oeis.org

2, 4, 8, 12, 16, 21, 26, 31, 36, 41, 47, 52, 58, 64, 69, 75, 81, 87, 93, 100, 106, 112, 119, 125, 131, 138, 144, 151, 158, 164, 171, 178, 184, 191, 198, 205, 212, 219, 226, 233, 240, 247, 254, 261, 268, 275, 283, 290, 297, 304, 312, 319, 326, 334, 341, 348, 356
Offset: 1

Views

Author

Mike Sheppard, Jan 13 2025

Keywords

Comments

The answer to the strong birthday problem is 3064, that is, a(365) = 3064. This is the number of people that need to be gathered together before there is a 50% chance that everyone in the gathering shares their birthday with at least one other person.

Crossrefs

Programs

  • Mathematica
    (* a(n)=m, n number of days, m number of people *)
    p[n_, m_] :=Sum[((-1)^i*n^(-m)*((-i + n)^((-i) + m))*n!*m!)/(i!*((-i + n)!)*((-i + m)!)), {i, 0, m}];
    a[n_] := Module[{m = n + 1, prob = 0}, While[prob < 0.5, prob = p[n, m]; m++;]; m - 1];
    Table[a[n], {n, 1, 20}]
  • PARI
    p(n,m) = sum(i=0, n, (-1)^i*(n-i)^(m-i)*binomial(n,i)*m!/(m-i)!)/n^m;
    a(n) = my(ma, mb=n+1, md); while(2*p(n,mb)<1, mb<<=1); ma=mb\2; while(mb>ma, md=(ma+mb)\2; if(2*p(n,md)<1, ma=md+1, mb=md)); ma; \\ Jinyuan Wang, Jan 24 2025
  • Python
    from math import comb, factorial
    def A380129(n):
        def p(m): return sum((-1 if i&1 else 1)*comb(m,i)*comb(n,i)*factorial(i)*(n-i)**(m-i) for i in range(m+1))<<1
        kmin, kmax = n, n+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) ~ -n LambertW(-1, -Log(2)/n).

A333507 Decimal expansion of 1 - ((365!) / ((365 - 23)! * 365^23)).

Original entry on oeis.org

5, 0, 7, 2, 9, 7, 2, 3, 4, 3, 2, 3, 9, 8, 5, 4, 0, 7, 2, 2, 5, 4, 1, 7, 2, 2, 8, 3, 3, 7, 0, 3, 2, 5, 0, 0, 2, 3, 5, 9, 7, 1, 8, 4, 5, 2, 9, 2, 9, 8, 7, 8, 0, 9, 9, 0, 1, 9, 7, 4, 0, 0, 2, 0, 0, 1, 8, 8, 4, 1, 8, 3, 9, 1, 8, 1, 2, 7, 7, 1, 5, 9, 9, 2, 2, 3, 3, 1, 6, 8, 0, 5, 3, 7, 0, 5, 3, 2, 0, 1, 1, 8, 6, 4, 8, 3, 2, 8, 4, 7, 7, 6, 5, 4, 2, 4, 6, 8, 6, 0
Offset: 0

Views

Author

Kritsada Moomuang, Mar 25 2020

Keywords

Comments

This is the probability that at least two people in a room of 23 randomly selected people share a birthday, ignoring leap days and assuming days are equiprobable.
This is a rational number; numerator and denominator both have 53 digits. - Charles R Greathouse IV, Jul 11 2020

Examples

			0.5072972343239854072254172283370325...
		

Crossrefs

Programs

  • Mathematica
    RealDigits[1- ((365!) / ((365 - 23)! * 365^23)), 10, 120]
  • PARI
    1. - 364!/(342! * 365^22) \\ Charles R Greathouse IV, Mar 25 2020
Showing 1-10 of 13 results. Next