Deterministic formula for average number of unique items picked I am curious how to formulate a deterministic answer to a problem I have in mind. I have computed it stochastically, but am unsure of how to frame and compute the problem deterministically. My prob & stats classes are a few decades behind me...
Let's say that we have 100 people, and each person is asked to choose a number between 1 and 100 (inclusive). Maybe everyone chooses the same number, but this is unlikely. It is also unlikely that everyone chooses a different unique number. How many of the numbers from 1 to 100 will get picked?
Stochastically, it seems that somewhere between 59 and 67 of the numbers will be picked (10th percentile and 90th percentile respectively) with a median example resulting in 63 of the numbers being chosen.
Is there a deterministic way calculate this? What concepts are relevant? How does the formula vary for a different number of people? And for a different number of numbers to choose?
Update: I'll include the Python script I ran to clarify what I meant by "Stochastically, it seems...":
import random
import statistics

trials = 10000
n = 100
m = 100

lens = []
for j in range(trials):
    k = []
    for x in range(n):
        k.append(random.randint(1,m))
    lens.append(len(list(set(k))))

print(statistics.median(lens), statistics.quantiles(lens, n=10))


Let $X_i \sim U[\{1, \ldots, n\}]$ for $ 1 \leq i \leq n $  meaning that $X_i$ are random variables representing the numbers picked by your $n$ individuals, each of whom picks with uniform probability (i.e. probability $\frac{1}{n}$. Then, you can write down a random variable $Y$ which captures the number of unique values in the realization of the collection $\{X_i\}_{i=1}^n$. That is
$$ Y = 1 + \sum_{i=2}^n \mathbb{1}\{X_i \neq X_j, j < i\}.$$
Taking expectations, we have that
$$ \begin{align*}
\mathbb{E}[Y] &= 1 + \sum_{i=2}^n \mathbb{P}(X_i \neq X_j, j < i) \\
&= 1 + \sum_{i=2}^n\prod_{j=1}^{i-1}\mathbb{P}(X_i \neq X_j) \\
&= 1 + \sum_{i=2}^n \left(1-\frac{1}{n}\right)^{i-1} \\
&= \sum_{i=1}^n\left(1-\frac{1}{n}\right)^{i-1} \\
&= n - n\left(1-\frac{1}{n}\right)^n
\end{align*}
$$
where we have used independence of the choices that individuals made in the second equality and the geometric partial sum formula to get a closed form in the last equality.
EDIT: I plugged this in python to see if I can verify what you did
 def calc_exp_y(n):
...     x = 0
...     for i in range(n):
...             x = x + (1-1/n)**i
...     return x
... 
>>> calc_exp_y(100)
63.396765872677015

