The problem is to design a program that can work out
how many people need to be in a room for the probability of 2 people
sharing the same birthday to be greater than 0.5.
If there are two people in a room, the probability of them
. . sharing the same birthday would be 1/365. . . . . Yes!
If there were 3 people then the probability would be 2/365. . . . . no
With 3 people, look at the opposite probability: no one shares a birthday.
The first person can have any birthday:
The second must have a different birthday:
The third must have yet another birthday:
We want people to share (at least) a birthday with probability greater than 0.5
The probability that none of them have the same birthday is:
When this product drops below 0.5, we've found it!
I trust you can write the program now . . .