What're the odds?

Okay, this might not be an exam P question, but it is a probability question. I am drawing a ball from a large bin of balls (with replacement, and with the balls being well stirred up each time I replace one). Only one of the balls is red. There are N balls. As a function of N, how often do I need to draw a ball to have a 50% chance of drawing a red ball?

If k draws, probability of no red ball is ((1-1/n)^k. So set that to 1/2, take logs of both sides.

If you want it in the form of a function you would need a ceiling as you have to round up:

ceiling{ ln.5/ln(1-1/n)]