Problem #PRU-115477

Problems Set theory and logic Mathematical logic Mathematical logic (other) Algorithm Theory Algorithm Theory

Problem

In the king’s prison, there are five cells numbered from 1 to 5. In each cell, there is one prisoner. Kristen persuaded the king to conduct an experiment: on the wall of each cell she writes at one point a number and at midnight, each prisoner will go to the cell with the indicated number (if the number on the wall coincides with the cell number, the prisoner does not go anywhere). On the following night at midnight, the prisoners again must move from their cell to another cell according to the instructions on the wall, and they do this for five nights. If the location of prisoners in the cells for all six days (including the first) is never repeated, then Kristen will be given the title of Wisdom, and the prisoners will be released. Help Kristen write numbers in the cells.