Home > Riddles > The light-bulb room

The light-bulb room

Master playsLevel 4/5

One hundred people can't talk to each other, but they share a single signal: a light bulb that can be on or off. The strategy consists of converting this minimum signal into a reliable counter, even without knowing its initial state.

There are 100 prisoners. Before you start, you can agree on a strategy.

Then, each day, the guard chooses one and takes him to a room with a light bulb, which can be on or off. The prisoners do not know the initial state of the light bulb.

Each prisoner can enter many times. On each visit you can leave the bulb as it is or change its status.

When leaving, he cannot communicate with others. At any time, anyone can declare: “We have all been through the room at least once.” If he is right, everyone is free; If you make a mistake, everyone dies.

What strategy allows you to declare with certainty that everyone has passed through the room?

Hints

Show hints
  1. No all must contar.
  2. A prisoner must actuar as contador.
  3. Since the initial state of the bulb is unknown, each non-counter must send two signals.

Solution

Show full solution

Answer: they choose an accountant. Each of the other 99 prisoners must send exactly two signals: each time they enter and find the light bulb out, they turn it on, until they have done so twice in total. The strategy is this: - Before starting, they designate a prisoner as an accountant.

  • Each prisoner other than the counter keeps his own account of signals sent.
  • If one of them enters, sees the light bulb off and has still sent less than two signals, he turns it on.
  • If you have already sent your two signals, you do not touch the bulb again.
  • If you enter and the light bulb is on, it does nothing.
  • The accountant, every time he enters and sees the light bulb on, turns it off and adds 1 to his account.
  • When the counter reaches 198, it declares that everyone has passed through the room. Why does it work? There are 99 prisoners who are not the counter, and each one must provide two signals: $$

99\cdot 2=198.

$$ If the light bulb started off, the 198 signals counted necessarily come from those 99 prisoners. Therefore, all of them have passed. If the light bulb started off, the counter might initially count a signal that was not sent by any prisoner. But even in that case, by the time we reach 198 counts, at least 197 real signals will have been produced by the non-counters. If any of the 99 non-accountants had never been in the room, the other 98 could only contribute at most: $$

98\cdot 2=196
$$ real signs. Adding the possible false initial signal, the counter could not reach 198. Therefore, when the counter reaches 198, all non-counters have passed at least once. And the accountant has also passed, because he himself has entered to count. This way you can state with certainty that everyone has been in the room.

Related riddles

Keep practicing

If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.

← Previous: The hundred prisoners with hats · Next: The veinticinco horses →