Choosing m, with replacement, from n, with a probability twist

64 Views Asked by At

I need to be able to answer questions like the one shown below. I believe this is related to the Monte-Carlo simulation:

A set holds integers $1$ to $1000.$ How many must I randomly choose, with replacement, to have a $50\%$ probability of having selected at least $200$ different integers?

More generally, I need a formula for:

Randomly choose $m$ elements, with replacement, from a set of $n$ elements. What is $m,$ given probability $p$ ($0\leq p\leq1$) of having selected $k$ different integers?