// Arup Guha
// 9/23/2014
// Written in COP 3930H - calculates the theoretical expected number
// of people we must ask until we get at least one person for each
// birth day.

#include <stdio.h>

int main() {

    double sum = 0;

    // To get the ith unique birthday, we expect to wait 365/(366-i) days.
    // This comes from the fact that the probability of getting a new birthday
    // after seeing i-1 of them is (366-i)/365. The intuitive flip of the fraction
    // can be proved by summing an infinite series.
    int i;
    for (i=1; i<=365; i++)
        sum = sum + 365.0/i;

    printf("Expected days to get all birthdays is %lf\n", sum);
    return 0;
}
