BIRTHDAY PROBLEM CODE

f[n_] := Product[365-k,{k,0,n-1}] / 365.0^n

f[12]
f[21]
f[22]
f[23]
f[27]

g[n_,D_] := Product[D-k,{k,0,n-1}] / (1.0D)^n
h[n_,D_] := (Gamma[D+1.0] / Gamma[D-(n-1) * 1.0]) /  (1.0  D)^n
guess[D_] := Sqrt[D Log[4.]] +.5

NSolve[h[n,365] == .5,n]
FindMinimum[(h[n,365] - .5)^2,n]
guess[365]

dpluto = 90500
NSolve[h[n,dpluto] == .5,n]
FindMinimum[(h[n,dpluto] - .5)^2,n]
guess[dpluto]