Two days ago, I found this problem on reddit (I didn't have access to reddit when I did the math, so I did it with 24 instead of 23, and I decided the warden picked someone every day, not "whenever he feels like it"):
A prison warden tells 24 prisoners he has a "game" for them. Once per day, the warden chooses one prisoner at random and leads them to the Switch Room. The aptly named Switch Room has two switches, both at the Off position at first, that are connected to nothing. The called prisoner has to toggle exactly one switch.
At any time, any prisoner can go to the warden and tell him that the 24 prisoners all went to the Switch Room at least once. If that's true, they're all freed. If not, they're going to be made into sausages for the other inmates or something.
The prisoners can come up with a plan now but won't ever be able to communicate again until someone tells the warden.
EDIT After some debating with @alex.jordan, I wanted to clarify my intent. My perspective is that this is a metaphor for "how would you tell that N distinct events, uniformly and randomly happening, all happened at least once if you only had 2 bits to spare", and has nothing to do with an actual warden (who could be biased in his random choices or use a different distribution model to screw up the prisoners), or actual prisoners.
I am solely interested in an answer that assumes a prisoner is selected randomly and uniformly once every day (not "from time to time" as stated in the reddit riddle), so you can safely ignore any assumption that the warden is out there to grind the prisoners to sausages or selects people with a bias or just won't ever select anyone.
The "classical" solution is that the prisoners designate one leader. When a prisoner enters the Switch Room (except the leader), if they've never been there and find the first switch in the Off position, they turn it on. Otherwise, they toggle the other switch. When the leader enters the Switch Room, if he sees the first switch in the On position, he knows that someone who's never been there before has been, so he counts one and turns off the switch. When he has counted to 23, he knows that everyone has been there at least one.
The thing is, this solution sucks. Assuming 24 prisoners again, and knowing they're picked at random, we can represent the whole thing as a series of geometric distributions (this also assumes I'm doing it right, which I may not be):
$$ X: \text{number of days before the Leader goes to the Switch Room}\\ X \sim Geom\left(\frac{1}{24}\right)\\ E(X) = 24, Var(X) = 552\\ $$ $$ Y_n: \text{number of days before one of the n remaining prisoner}\\ \text{goes to the Switch Room for the first time (n from 1 through 23)}\\ Y_n \sim Geom\left(\frac{n}{24}\right)\\ E(Y_n) = \frac{24}{n}, Var(Y_n) = \frac{24 (24-n)}{n^2} $$
Since expected values and variance can be linearly added, we can expect that the Leader will tell the warden after on average 642 days, with a standard deviation of 116, by assuming the leader will go $E(X)$ days after any given prisoner went for the first time as modeled by $E(Y_n)$:
$$ Z: \text{Number of days before the Leader announces everyone's been to the Switch Room}\\ E(Z) = \sum_{n=1}^{23}E(X) + E(Y_n) = 552 + \sum_{n=1}^{23}E(Y_n) \approx 552 + 89.6229 \approx 641.6229\\ Var(Z) = \sum_{n=1}^{23}Var(X) + Var(Y_n) = 12696 + \sum_{n=1}^{23}Var(Y_n) \approx 12696 + 833.3521 \approx 13529.3521\\ \sigma = \sqrt{13529.3521} = 116.3157 $$
Very simple maths tell us that after 642 days, every prisoner's been on average 26 times to the Switch Room. This looks like a horrible waste of time.
I'm pretty sure it's possible to calculate how many days you would need to wait before you have 99% chances (or higher) that each prisoner has been there. Problem is, I'm only halfway through my college stats class, and we've only seen easy distributions where successes are independent, so I'm not too sure how to tackle that.
How would you calculate the chances that each prisoner has been to the Switch Room after $Z$ days?
EDIT I just made a quick and dirty program to run "simulations", and it takes on average 90.6 days until every prisoner has visited the Switch Room, with a standard deviation of 28.5. Making that into a normal distribution, it should be around 157 days before we can say with 99% certainty that each prisoner has visited the Switch Room at least once, and 179 days for 99.9% certainty. Needless to say, you're pretty safe after 641 days...
It's an empirical technique and it doesn't really feel mathematically satisfying, so the question is still open for better answers.