Finding n for a given P of a Bernoulli trial

153 Views Asked by At

I'm randomly sampling $N$ items and I want to find $n$ such that I have a probability $P$ that I'll miss one. Practically, I'd select $P$ to be something like $10^{-12}$ so I'm almost assured to sample everything from among a relatively small sample set of $n$ things (this is for some program tester).

Anyways, using the Bernoulli trials equation of

$$P = \binom{n}{k}p^kq^{n-k}$$

where $k$ = 1, and $p = N^{-1}$, I think I've simplified it correctly as shown:

$$ \begin{align}P &= \frac{n!}{(n-1)!}\left(\frac1N\right)\left(1-\frac1N\right)^{n-1} \\ P &= \frac{n}{N}\left(\frac{N-1}{N}\right)^{n-1} \\ PN^n &= n(N-1)^{n-1} \\ n \ln (PN) &= \ln(n) + (n-1)\ln(N-1) \end{align}$$

Now I don't know where to go; I can't seem to solve for $n$. The second line seems closer, but I can't seem to figure out how to solve for $x$ given something like $xk^x$ (I could also get this I think:)

$$\left(N-1\right)P = n\left(\frac{N-1}{N}\right)^n$$