Problem 1267. Calculate the probability that at least two people in a group share the same birthday.
Calculate the probability that at least two people in a group share the same birthday. Given an integer input n, return to 0.015 (1.5%) precision the probability of this being the case. Assume that every day is equally probable as a birthday and ignore the leap year.
Example:
Input: 1 Output: 0.00
Input: 366 Output: 1.00
Solution Stats
Problem Comments
-
3 Comments
I assume n is the number of people in the room.....
Although I got the solution, in the case of n=100, however, it results in 1.000, which means there MUST be at least two people share their birthday in a group of 100. Am I missing something here?
In case n=100 the exact probability is 0.999999692751072 therefore it could happen (although it is very unlikely) that no one shares the same birthday
Solution Comments
Show commentsProblem Recent Solvers103
Suggested Problems
-
4558 Solvers
-
Project Euler: Problem 1, Multiples of 3 and 5
3650 Solvers
-
Project Euler: Problem 5, Smallest multiple
1640 Solvers
-
1060 Solvers
-
Find Index of maximum Value and maximum Value of a vector
167 Solvers
More from this Author7
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!