bdayprob=function(N) { i1=365 i2=365-N+1 xx=i1:i2 x1=sum(log(xx)) x2 = N*log(365) probs = 1 - exp(x1-x2) probs }