# What is the probability that 23 people have different birthdays?
#
# Probability that birthday #2 is different from #1 is 364/365.
#
# Probability that birthday #3 is different from #1 and #2 is 363/365.
#
# Probability that birthday #4 ... etc.
#
# For convenience, multiply by 365/365 and write
#
# 365 364 363 343 365! / (365 - 23)!
# p = --- * --- * --- * ... * --- = ------------------
# 365 365 365 365 365^23
#
# for the probability that 23 people have different birthdays.
"Product method"
p = product(k,1,23,(365-k+1)/365)
float(p)
"Factorial method"
p = 365! / (365 - 23)! / 365^23
float(p)
"Probability of at least one shared birthday"
1.0 - p