# The evil jailer

An evil jailer has 10 prisoners locked up. Each of them is imprisoned in an individual cell totally isolated and incommunicado from those of their peers. In the prison there is a totally isolated room that cannot be seen from any of the prisoners' cells and that has a light bulb that was initially turned off.

Every day the jailer takes a randomly chosen prisoner to the common room and gives him the opportunity to turn on the light bulb, turn it off or leave it as is. Each prisoner can be chosen several times to go to the ward and it is certain that everyone will go through it periodically.

The jailer assures them that he will only release them at the time that an inmate guesses when the 10 prisoners have passed through the room at least once. If any of them make a mistake in stating that everyone has passed through the room at least once, they will die.

In a moment of weakness, the jailer allows the 10 prisoners to meet to say goodbye before beginning their isolation. At that time, the prisoners make a plan that will allow them to know at any given time and with total certainty that they have all passed through the common room.

Can you think of a plan so they can be saved?

Extracted from the page of Sara Ferrero

#### Solution

One of the prisoners is appointed leader who will communicate the following plan to the other nine prisoners:
The first time each of you goes to the room and finds the light off, you must turn it on. This means that if one has already given the switch to turn it on, in no case should he give the switch again another day; It also means that if one has never turned it on but finds the light on, you should leave it as it is and wait for your chance to have it turned on another day.

The leader on his part, every time he goes to the room and finds the light on, he must turn it off and add one to his own account. If it is turned off it will leave it as it is. When you have turned off the light nine times, you can tell the jailer that everyone has passed by.