Probability distribution for birthday paradox
In Wikipedia we read
In an alternative formulation of the birthday problem, one asks the average number of people required to find a pair with the same birthday. If we consider the probability function Pr[n people have at least one shared birthday], this average is determining the mean of the distribution, as opposed to the customary formulation, which asks for the median. Wikipedia
However no probability distribution $Pr$ is given. What is $Pr$ ?
The linked page suggests that, instead of computing the smallest $n$ such that the probability that at least two of the $n$ people share a birthday is at least 0.5, which is the typical "birthday problem",...
...to consider the experiment in which you ask people for their birthdays until a birthday is repeated, with $n$ being the number of people that you needed to ask. If we say that there are only 365 possible birthdays (ignoring Feb 29), then the outcome of this experiment is a random variable that has a probability mass function on the support $n=2, 3, \ldots, 366$.
The probability mass function is defined by:
$$P(X=2) = 1/365$$ $$\text{For $x \in \mathbb{N}, 2<x\le 366$, }P(X=x) = \left[1 - \sum_{i=2}^{x-1} P(X=i)\right]\left(\frac{x-1}{365}\right)$$
The expected value of the random variable is approximately $24.616585$, which can be found numerically using the following Python code:
import numpy as np
probs = np.zeros(366)
for i in range(1,366):
probs[i] = (1-np.sum(probs[:i]))*i/365
print(f"Total probability = {probs.sum()}")
expected = np.sum((np.arange(366) + 1)*probs)
print(f"Expected value = {expected}")