% This solves the birthday problem assuming 365 days % in the year, each equally likely of arising as a birthday % Here n is the number of people in a room and the project % computes the probability that no two have the same birthday and % subtracts this from 1 to find the probability at least two people % have the same birthday, and graphs this % a1=[ ]; a2=[ ]; for i=2:60 c=1.; for j=1:i-1 c=c*(365.-j)/365.; end; a1=[a1 i]; a2=[a2 1.-c]; end; plot(a1,a2),pause