How Many PRISONERS Are Free?
There are 50 prisoners in a row of locked cells. With the return of the King from the Crusades, a partial amnesty is declared and it works like this. When the prisoners are still asleep, the jailer walks past the cells 50 times, each time walking from left to right. On the first pass, he turns the lock in every cell (so that every cell is now open). On the second pass he turns the lock on every second cell (meaning that these cells are now locked again). On the third pass, he turns the lock on every third cell, and so on. In general, on thekth pass, he turns the lock on every kth cell. The question is: how many cells are unlocked at the end of the process so that the prisoner is free to go?