I think I found it (partially based on Thomas answer above). Here's the correct reasoning:
- Put the first person in the room. His probability of sharing a birthday with anyone is 0.
- Put the second person in the room. His probability of sharing a birthday with anyone is 1/365.
- Put the third person in the room. His probability of sharing a birthday with anyone is (the probability, given that the previous people in the room didn't share a birthday, is (1 - 1/365) * (2/265). Therefore (364/365)(2/365)
- Put the fourth person in the room. His probability of sharing a birthday with anyone is (the probability, given that none of the previous people in the room didn't share a birthdaydid, is (1-P(3)) * (3/365).
So on and so forth.
So basically for the Nth person, the probability of him sharing a birthday with anyone in the room already, given that no one before did, P(N), is:
P(N) = (1 - P(N-1)) * ((N-1)/365)
And P(1) = 0.
If you want to calculate the probability with 23 people in the room, therefore, you just need to add all the individual P(N).