如果我的计算是正确的,那么 60 人一组有一个 Triple 和 11 Pairs 的几率是
365*1*1 364*1 363*1 354*1 1 353 352 319
60c3 * ------- * 57c2 * ----- * 55c2 * ----- * ... * 37c2 * ----- * --- * --- * --- * ... * ---
365^3 365^2 365^2 365^2 11! 365 365 365
结果是 0.0036%。
请注意,这60c3
意味着“60 选择 3”,与 相同60! / (57! * 3!)
。另请注意,1/11!
软糖因素是由于您有 11 对可以按任何顺序重新排列的事实。我用来计算百分比的代码如下所示。你应该检查它,以及上面的公式的准确性。使用风险自负。没有任何明示或暗示的保证。
double result, people, daysleft;
// start with the triplets: 60c3 * 365 / 365^3
result = (60.0 * 59.0 * 58.0) / (6.0 * 365.0 * 365.0);
// now consider the pairs: Nc2 * daysleft / 365^2
people = 57.0;
daysleft = 364.0;
for ( i = 0; i < 11; i++ )
{
result *= (people * (people - 1.0) * daysleft) / (2.0 * 365.0 * 365.0);
people -= 2.0;
daysleft -= 1.0;
}
// there are 11 factorial ways to rearrange the pairs
for ( i = 11; i > 0; i-- )
result /= (double)i;
// finish up with the unique birthdays
for ( i = 0; i < 35; i++ )
{
result *= daysleft / 365.0;
daysleft -= 1.0;
}
printf( "%lf%%\n", result * 100.0 );