Skip to main content
added 8 characters in body
Source Link

One thing that is implied by the puzzle, asis that the prisoners know their own order, and the order of all prisoners before them, so the 7th prisoner will know it all. Thus our solution will consist of two parts: firstly we figure out how the first 6 prisoners could encode their cell information to prisoner 7. Secondly we solve how the prisoner 7 can communicate back the final solution, and the prisoners order back to everyone. Note, that the first prisoner does not know the order in which the rest of the prisoners went, and yet they will need to know which prisoner went to which cell.

One thing that is implied by the puzzle, as that prisoners know their own order, and order of all prisoners before them, so the 7th prisoner will know it all. Thus our solution will consist of two parts: firstly we figure out how the first 6 prisoners could encode their cell information to prisoner 7. Secondly we solve how the prisoner 7 can communicate back the final solution, and the prisoners order back to everyone. Note, that the first prisoner does not know the order in which the rest of the prisoners went, and yet they will need to know which prisoner went to which cell.

One thing that is implied by the puzzle, is that the prisoners know their own order, and the order of all prisoners before them, so the 7th prisoner will know it all. Thus our solution will consist of two parts: firstly we figure out how the first 6 prisoners could encode their cell information to prisoner 7. Secondly we solve how the prisoner 7 can communicate back the final solution, and the prisoners order back to everyone. Note, that the first prisoner does not know the order in which the rest of the prisoners went, and yet they will need to know which prisoner went to which cell.

added 1 character in body
Source Link

When a person wants to encode less than 6 numbers e.g. [6,1,2], because they do not know who comes after them, in order for Lehmer encoding to work they need to fill in the remaining slots up to 6 with the numbers that were not taken so far; the order of those remaining numbers does not matter, the next person who decodes this number will know that they are 4th in order (since they know theytheir own order) and they will be able to discard all the numbers but the first 3 based on that.

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater than their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the final cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

When a person wants to encode less than 6 numbers e.g. [6,1,2], because they do not know who comes after them, in order for Lehmer encoding to work they need to fill in the remaining slots up to 6 with the numbers that were not taken so far; the order of those remaining numbers does not matter, the next person who decodes this number will know that they are 4th in order (since they know they own order) and they will be able to discard all the numbers but the first 3 based on that.

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the final cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

When a person wants to encode less than 6 numbers e.g. [6,1,2], because they do not know who comes after them, in order for Lehmer encoding to work they need to fill in the remaining slots up to 6 with the numbers that were not taken so far; the order of those remaining numbers does not matter, the next person who decodes this number will know that they are 4th in order (since they know their own order) and they will be able to discard all the numbers but the first 3 based on that.

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater than their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the final cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

added 1 character in body
Source Link

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the finefinal cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

Finally on the next day each person will see that number left for them. They decode it back to the 6 number sequence and add 7 at the end for Guy. Now, since they know what their own cell is and where they are on the list (the list is now ordered from Ana to Guy, and they know their own name) thethey can calculate the offset applied to the cell numbers by taking the difference between their cell number and the cell number corresponding to then inthem on the list. After this they need to apply this offset to every cell in the list to get the final mapping between all the mathematicians and their cells.

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the fine cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

Finally on the next day each person will see that number left for them. They decode it back to the 6 number sequence and add 7 at the end for Guy. Now, since they know what their own cell is and where they are on the list (the list is now ordered from Ana to Guy, and they know their own name) the can calculate the offset applied to the cell numbers by taking the difference between their cell number and the cell number corresponding to then in the list. After this they need to apply this offset to every cell in the list to get the final mapping between all the mathematicians and their cells.

Now we are coming to the second part. The 7th person in king's order got the encoded number from the 6th person and by incrementing back every number on the list that is equal or greater their cell number, and then appending their own cell number at the end, they will get the complete list. [6,1,2,4,5,3] for the seventh person in cell 3 will become [6->7,1,2,4->5,5->6,3->4], or [7,1,2,5,6,4], and after adding the final cell 3 we arrive to the initial [7,1,2,5,6,4,3] list. Now this last person needs to do the last final encoding, that will give the rest of the team their final answer. In order to do that this person will a) rearrange the cells list so that the people in the list appear in pre-agreed order, e.g.: Ann, Ben, Cid, Dan, Eve, Flo and Guy; and b) will re-label each room number by adding the same offset by modulo 7 to each room. The offset is chosen so that Guy always ends up in the room 7 after re-labelling. After those two steps we will get the 7 cell numbers in the list, with the last number being 7, because the last person is Guy and we chose the offset so that they are always in the room 7. The last person in the king's order takes the first 6 numbers from this list and encode them and put them on the clock face for everyone to see next day on the way back to the king.

Finally on the next day each person will see that number left for them. They decode it back to the 6 number sequence and add 7 at the end for Guy. Now, since they know what their own cell is and where they are on the list (the list is now ordered from Ana to Guy, and they know their own name) they can calculate the offset applied to the cell numbers by taking the difference between their cell number and the cell number corresponding to them on the list. After this they need to apply this offset to every cell in the list to get the final mapping between all the mathematicians and their cells.

added 1 character in body
Source Link
Loading
Source Link
Loading