# Imprisoned Logicians

Two friends, logicians – Ein and Stein, get imprisoned in two distant cells in a castle. Both cells have just one door, and a window with 8 bars in the first cell, and 12 bars in the second cell. The first day both logicians get the same letter from the prison master:

“The total number of bars in the two prison cells in this castle is either 18 or 20. Starting tomorrow, every morning I will go first to Ein and then to Stein, and will ask how many bars the other logician has. If one of you answers correctly, I will immediately let both of you leave the castle. If one of you answers incorrectly, I will execute both of you. Of course, you can always decide not to answer and just stay imprisoned.
I have sent a copy of this letter to you and your friend. There is no point in trying to communicate with him – your cells are far away from each other and he won’t hear you.”

Will the logicians manage to escape the castle eventually? When will they do it?

On the second day, Ein will know that Stein has realized that the number of bars in Ein’s cell is at most 18 (assuming the windows can have 0 bars on them), because otherwise, Ein would have guessed correctly 20. On the third day, Stein will know that Ein has realized that the number of bars in Stein’s cell is between 2 and 18, because otherwise, Stein would have guessed the exact number the previous day. Later, Ein will know that Stein has realized that the number of bars in Ein’s cell is between 2 and 16, because otherwise, Ein would have guessed the exact number. On the fourth day, Stein will know that Ein has realized that the number of bars in Stein’s cell is between 4 and 16. After that, Ein will know that Stein has realized that the number of bars in Ein’s cell is between 4 and 14. On the fifth day, Stein will know that Ein has realized that the number of bars in Stein’s cell is between 6 and 14, and Ein will know that Stein has realized that the number of bars in Ein’s cell is between 6 and 12. On the sixth day, Stein will know that Ein has realized that the number of bars in Stein’s cell is between 8 and 12, and Ein will know that Stein has realized that the number of bars in Ein’s cell is between 8 and 10. Finally, Stein will conclude that the number of bars in Ein’s cell must be 8, and that the total number of bars in the castle is 20.

##### Unknown Author
+ latest posts

We do not know where this puzzle originated from. If you have any information, please let us know via email.