aez-notes

Birthday holidays

Labor laws in Erewhon require factory owners to give every worker a holiday whenever one of them has a birthday and to hire without discrimination on grounds of birthdays. Except for these holidays they work a 365-day year. The owners want to maximise the expected total number of man-days worked per year in a factory. How many workers do factories have in Erewhon?

The number of man days worked is \(\sum_{i} i W_{i}\) where \(W_{i}\) is the indicator for working on day \(i\). Expectation is linear so the expected number of days worked by a factory employing \(n\) people is \(365 n P(W=1)\).

The probability \(W=1\) is the probability that no one has a birthday on that day which is just \((1-1/365)^{n}\). We can then use calculus to narrow in on the correct value and do two evaluations to work out the best integer value.

mean_days_worked(n) := n * 365 * (1 - 1/365)^n;
sol : subst(solve(diff(mean_days_worked(n), n), n), n);

print(sol);
/*
         1
-------------------
log(365) - log(364)
*/

for n:363 step 1 thru 366 do {
  print([n,float(mean_days_worked(n))])
};

/*
[363, 48943.1544091142]
[364, 48943.52380535112]
[365, 48943.52380535112]
[366, 48943.15643043045]
*/

Author: Alex Zarebski

Created: 2022-04-15 Fri 12:29

Validate