Background:
So today I visit a booth at my college giving free gifts. Since the gifts are alluring, many students queue besides the booth.
Question:
Assume there are $m$ gifts left. Everyone have a $0
Background:
So today I visit a booth at my college giving free gifts. Since the gifts are alluring, many students queue besides the booth.
Question:
Assume there are $m$ gifts left. Everyone have a $0
If $k \leq m$, the probability of success is just $n$.
If $k>m$,
Suppose you are at position $k$, ask the $k-1$ people in front of you to toss a coin, those coin has the probability of being head with probability $n$. If they obtain head in their coin toss, give them the gift (while stock lasts).
Hence out of these $k-1$ people, we can afford $m-1$ heads at most so that we have a chance to get a prize. Also, we need to toss a head as well.
Hence the probability of winning is
$$\sum_{i=0}^{m-1}\begin{pmatrix} k-1 \\ i\end{pmatrix}n^i(1-n)^{k-1-i}n$$
Hence, we have to solve for $k$ that satisfies
$$\sum_{i=0}^{m-1}\begin{pmatrix} k-1 \\ i\end{pmatrix}n^{i}(1-n)^{k-1-i}n>p$$
$$\sum_{i=0}^{m-1}\begin{pmatrix} k-1 \\ i\end{pmatrix}n^{i}(1-n)^{k-1-i}>\frac{p}{n}$$