# A Prisoners Riddle

I just heard a nice riddle and wanted to share.

Prisoner A and prisoner B are given an integer between 1 and 100. Each prisoner only knows his own number, but also that the two numbers are consecutive. For example, if prisoner A got the number 60, he knows that prisoner B got either 59 or 61. At the end of every hour each prisoner can choose to guess the number of the other. If either prisoner guesses correctly, they both go free. However, if either prisoner guesses wrong, they both get executed (even if at the same time the other guessed correctly). Both prisoners can choose not to guess for as many hours as they like.

The two prisoners are in different cells and cannot communicate in any way. Also, they did not have time to coordinate a strategy in advance. Each can only assume that the other prisoner is intelligent. Can they always guess correctly? After how many hours?

I think it would be nice not to post solutions in the comments. Although you can just write the number of hours you got.