Easy Stats Question: Sampling a bag of 457 marbles, I have a bag of 457 marbles, 111 of which are black, and 346 are white. How many marbles do I need to remove from the bag (without replacement) to be 95% certain that I get at least one black marble?  I'm not looking for a specific answer - I want to understand how to solve problems like this.
TIA!
 A: Suppose you first want to find the probability that after sampling $n$ marbles without replacement from the bag that contains $N$ marbles in total and $K$ black marbles, at least 1 of these marbles is a black marble.
If the random variable $X$ is the number of black marbles in your sample of $n$ marbles, then $X$ is a hypergeometric random variable with probability mass function:
$$
p(X = k) = \frac{{K \choose k}{N - K \choose n - k}}{{N \choose n}}
$$
Therefore, what we need is $p(X \geq 1)$. Since:
$$
p(X \geq 1) = 1 - p(X = 0)
$$
Then what we actually need is $p(X = 0)$. However, we do not know the sample size $n$ in this case. What we do know is that:
$$
p(X \geq 1) = 0.95
$$
Or:
$$
p(X = 0) = 0.05
$$
You know the total number of marbles in the bag $N$ and the total number of black marbles in the bag $K$, but you don't know $n$, which you can solve for using the PMF of $X$:
$$
p(X = 0) = 0.05 = \frac{{111 \choose 0}{346 \choose n}}{{457 \choose n}}
$$
Since:
$$
{111 \choose 0} = 1 \\
{346 \choose n} = \frac{346!}{n!(346 - n)!} \\
{457 \choose n} = \frac{457!}{n!(457 - n)!}
$$
Then:
$$ \begin{align}
0.05 &= \frac{346!}{n!(346 - n)!} \cdot \frac{n!(457 - n)!}{457!} \\
&= \frac{346!}{(346 - n)!} \cdot \frac{(457 - n)!}{457!} \\
\end{align}$$
You can then solve for $n$ using Stirling's approximation of the factorial function.
A: @mhdadk's answer (+1) is fine, and possibly shows the
intended method. The question is whether Stirling's
approximation needs to be supplemented with
exact numerical computation to get the exact number $n.$
The following computation in R using a hypergeometric
PDF dhyper finds that $n = 11$ is the answer. The program tries values of $n$ up to 20,
and checks for the smallest $n$ with probability less
than 5% of getting no black balls in a sample without
replacement. [Originally used values up to 457, but
quickly saw that's overkill.]
n = 0:20;  pr = dhyper(0, 111,346, n)
min(n[pr < .05])
[1] 11
dhyper(0, 111,346, 10:12)
[1] 0.05993150 0.04504918 0.03383739  # verify n=11

plot(n, pr); abline(h=0.05, col="green2")


