function y=bday(n) %Function to calculate the probability that in a room of n people, no %two will have the same birthday. The number of possible birthdays is %365 by default, but can be changed by assigning a new value to "base" %in the program (for example, set base=12 for calculating the probability %that no two will have birthdays in the same month). base=365; y=1; for i=1:n, y=y*(base-i+1)/base; end return