25
points
Questions
0
Answers
2
-
safest way i could think of if they assign ID’s 1 to 23 to each of the prisoners (they have to remember their ID’s of-course) and based on their ID
if (even ) flip switch at ur right and if odd flip switch at ur left.
Initially switches can be 00 (off off) or 11 (on on)
Let make a table how switch order changes with every press by each ID’s (they are drawing in group meeting before it starts)
Person ID Switch Left – Switch Right
00
01. 01
02. 11
03. 10
04. 0005. 01
06. 11
07. 10
08. 0009. 01
10. 11
11. 10
12. 0013. 01
14. 11
15. 10
16. 0017. 01
18. 11
19. 10
10. 0011. 01
12. 11
13. 10
14. 0015. 01
16. 11
17. 10
18. 0019. 01
20. 11
21. 10
22. 0023. 01
// again 01
01. 00
02. 10
03. 11
04. 1005. 11
06. 10
07. 11
08. 01and so on ….
Now you see a pattern doesn’t matter what the initial state of switch is all even ID’s should expect to see the same (00 or 11) in first round and once all 23 visited in second round all odd ID’s will see the switch state same (00 or 11) i.e, once the same person sees the same state (00 or 11) thrice either in order 00 –> 11 –> 00 or 11–> 00 –> 11 i.e, he knows three rounds are done and everyone should have visited it once. So, he can announce the freedom call 😉
The fact that prisoner can pick ” the same guy three times in a row” – doesn’t matter it will flip back to original state. (00 -> odd person came in thrice 01-> 00 -> 01.) and NOTE : he will see the order 00 -> 00 –>not 00 –> 01 –> so no chance of miss calculations.
Only thing they have to remember is their ID’s and once you see 00 –> 11 –> 00 or 11–> 00 –> 11 pattern after u n visits you are good to make a call .
To me on absolutely safe side if in case u don’t want to miss any corner case you can extend the freedom pattern like –> 00 –> 11 –> 00 –> 11 or 11–> 00 –> 11 –> 00 . Or even bigger if you want to enjoy few more nights in prison.
Thanks,
Dhruva- 45170 views
- 3 answers
- 0 votes
-
I am a digital hardware engineer — Here goes my solution
i’ll require 3 bit to give id to each bar 1st
000
001
010
011
100
101
110
111Here if you know each bit represent weights of 4, 2 and 1 i.e, 111 means 4*1+2*1+1*1 = 7
Now you know min bar length of 4, 2 and 1 we can use to represent / distribute all 7 pieces.
421
001 –> give bar1 1st day (weight1 is 1 and rest are 0)
010 –> take bar1 back (see weight1 is 0) and give bar 2 (weight2 is 1 )
011 –> give bar1 back again
100 –> take both bar1 , bar2 and give bar 4.
101 –> give bar1 again.
110 –> take bar1 back and give bar2 again.
111 –> give bar1 as well. We are done 🙂- 66660 views
- 3 answers
- 1 votes