Created
November 17, 2021 01:18
-
-
Save efruchter/8aef9abbee97090ca7148834538c54fb to your computer and use it in GitHub Desktop.
calculate the probabilities that a group of n people will have at least two people within that share the same birthday.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double CurProb = 1; | |
std::cout << 1 << ": " << 0.0 << std::endl; | |
for (int i = 1; i < 100; i++) | |
{ | |
double bp = (365.0 - (double)i) / 365.0; | |
CurProb *= bp; | |
std::cout << (i + 1) << ": " << (1.0 - CurProb) << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment