Recitation 12 should be submitted following directions at:
submissions
with deadlines
|
It is easier to calculate the probability that among
n people, no two have the same
birthday. Denote this by N(n).
For two people, the second one will have a birthday different
from the first with probability:
N(2) = 364/365.
If there is a third person
the probability that he will have a birthday different from
the first two (which are assumed distinct now),
is 363/365, so that
N(3) = (364/365)*(363/365).
Similarly,
N(4) = (364/365)*(363/365)*(362/365).
Of course, N(1) = 1.
The probability, call it S(n), that at least two
people from among n have the same birthday
is just:
S(n) = 1 - N(n).
Write a simple program that will calculate and print S(n) for n = 1, 2, 3, ..., 50. These should be calculated as doubles.