% LMex020706_4th.m
% Example 2.7.6 The birthday problem p 118-119 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% Writtten by Eugene Gallagher, Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% Written 1/16/2011 & last revised 1/16/2011
% What is the probability that two students out of a group of k will share
% the same birthday?
% calls Gallagher's birthdays.m
disp('            Table 2.7.1')
k=[15 22 23 40 50 70]';
fprintf('  k    P(at least 2 with same birthday)\n')
for i=1:length(k)
    P=birthdays(k(i));
    fprintf('%2.0f                %5.3f\n',k(i),P)
end