Problem. prisoners; each day one is chosen uniformly at random and visits a room with a light bulb (initially off) that they may toggle. At any time a prisoner may declare that everyone has visited; if wrong, all lose. They may agree on a strategy beforehand.

Counter strategy: one prisoner is the counter. Every other prisoner turns the light on the first time they find it off (and never again); the counter turns it off whenever it is on and counts. When the count reaches , the counter declares, and the declaration is always correct.

double bulbExpectedDays(int n) {                       // counter strategy: phases alternate "new pirate switches on" and "counter visits"
    double e = 0;
    for (int i = 0; i < n - 1; i++) e += (double)n / (n - 1 - i) + n;
    return e;
}
expected days (counter strategy)
8about 77
100about 10418 (28.5 years)