1. The Emperor You are the ruler of a medieval empire and you are about to have a celebration tomorrow. The celebration is the most important party you have ever hosted. You've got 1000 bottles of wine you were planning to open for the celebration, but you find out that one of them is poisoned. The poison exhibits no symptoms until death. Death occurs within ten to twenty hours after consuming even the minutest amount of poison. You have over a thousand slaves at your disposal and just under 24 hours to determine which single bottle is poisoned. You have a handful of prisoners about to be executed, and it would mar your celebration to have anyone else killed. What is the smallest number of prisoners you must have to drink from the bottles to be absolutely sure to find the poisoned bottle within 24 hours? Guess: Guess | Show Hint Show Solution | Comments (28) Hint: It is much smaller than you first might think. Try to solve the problem first with one poisoned bottle out of eight total bottles of wine. Solution: 10 prisoners must sample the wine. Bonus points if you worked out a way to ensure than no more than 8 prisoners die. Number all bottles using binary digits. Assign each prisoner to one of the binary flags. Prisoners must take a sip from each bottle where their binary flag is set. Here is how you would find one poisoned bottle out of eight total bottles of wine. 1 2 3 4 5 6 7 8 Prisoner A X X X X Prisoner B X X X X Prisoner C X X X X In the above example, if all prisoners die, bottle 8 is bad. If none die, bottle 1 is bad. If A & B dies, bottle 4 is bad. With ten people there are 1024 unique combinations so you could test up to 1024 bottles of wine. Each of the ten prisoners will take a small sip from about 500 bottles. Each sip should take no longer than 15 seconds and should be a very small amount. Small sips not only leave more wine for guests. Small sips also avoid death by alcohol poisoning. As long as each prisoner is administered about a millilitre from each bottle, they will only consume the equivalent of about one bottle of wine each. Each prisoner will have at least a fifty percent chance of living. There is only one binary combination where all prisoners must sip from the wine. If there are ten prisoners then there are ten more combinations where all but one prisoner must sip from the wine. By avoiding these two types of combinations you can ensure no more than 8 prisoners die. One viewer felt that this solution was in flagrant contempt of restaurant etiquette. The emperor paid for this wine, so there should be no need to prove to the guests that wine is the same as the label. I am not even sure if ancient wine even came with labels affixed. However, it is true that after leaving the wine open for a day, that this medieval wine will taste more like vinegar than it ever did. C'est la vie.
2. The Stark Raving Mad King A stark raving mad king tells his 100 wisest men he is about to line them up and that he will place either a red or blue hat on each of their heads. Once lined up, they must not communicate amongst themselves. Nor may they attempt to look behind them or remove their own hat. The king tells the wise men that they will be able to see all the hats in front of them. They will not be able to see the color of their own hat or the hats behind them, although they will be able to hear the answers from all those behind them. The king will then start with the wise man in the back and ask "what color is your hat?" The wise man will only be allowed to answer "red" or "blue," nothing more. If the answer is incorrect then the wise man will be silently killed. If the answer is correct then the wise man may live but must remain absolutely silent. The king will then move on to the next wise man and repeat the question. The king makes it clear that if anyone breaks the rules then all the wise men will die, then allows the wise men to consult before lining them up. The king listens in while the wise men consult each other to make sure they don't devise a plan to cheat. To communicate anything more than their guess of red or blue by coughing or shuffling would be breaking the rules. What is the maximum number of men they can be guaranteed to save? Guess: Guess | Show Hint Show Solution | Comments (19) Hint: To solve this problem, you need to presume that each wise man can count the total number of red hats in front of them without error, that all the wise men have great attention to detail and that all the wise men care about the greater good. Solution: 99. You can save about 50% by having everyone guess randomly. You can save 50% or more if every even person agrees to call out the color of the hat in front of them. That way the person in front knows what color their hat is, and if the person behind also has the same colored hat then both will survive. So how can 99 people be saved? The first wise man counts all the red hats he can see (Q) and then answers "blue" if the number is odd or "red" if the number is even. Each subsequent wise man keeps track of the number of red hats known to have been saved from behind (X), and counts the number of red hats in front (Y). If Q was even, and if X&Y are either both even or are both odd, then the wise man would answer blue. Otherwise the wise man would answer red. If Q was odd, and if X&Y are either both even or are both odd, then the wise man would answer red. Otherwise the wise man would answer blue. There can be any number of red hats, as the following examples show... Prisoner Hat he wears Number of red hats he sees (Y) Red hats saved for sure (X) He says 1 red 6 even (Q) N/A red 2 blue 6 even 0 even blue 3 red 5 odd 0 even red 4 blue 5 odd 1 odd blue 5 blue 5 odd 1 odd blue 6 red 4 even 1 odd red 7 red 3 odd 2 even red 8 red 2 even 3 odd red 9 red 1 odd 4 even red 10 red 0 even 5 odd red Another example might also help, as this puzzle seems to trip up most people... Prisoner Hat he wears Number of red hats he sees (Y) Red hats saved for sure (X) He says 1 blue 5 odd (Q) N/A blue 2 blue 5 odd 0 even blue 3 red 4 even 0 even red 4 blue 4 even 1 odd blue 5 blue 4 even 1 odd blue 6 red 3 odd 1 odd red 7 blue 3 odd 2 even blue 8 red 2 even 2 even red 9 red 1 odd 3 odd red 10 red 0 even 3 odd red
3. The Fake Coin You have twelve coins. You know that one is fake. The only thing that distinguishes the fake coin from the real coins is that its weight is imperceptibly different. You have a perfectly balanced scale. The scale only tells you which side weighs more than the other side. What is the smallest number of times you must use the scale in order to always find the fake coin? Use only the twelve coins themselves and no others, no other weights, no cutting coins, no pencil marks on the scale. etc. These are modern coins, so the fake coin is not necessarily lighter. Presume the worst case scenario, and don't hope that you will pick the right coin on the first attempt. Guess: Guess | Show Hint Show Solution | Comments (77) Hint: The balance tells you which side is heavier and which side is lighter. You can move coins around and get more information this way. Solution: 3. If you knew the fake coin was lighter, then the solution would have an easy explanation. But you do not. So.... Number the coins 1 through 12. 1. Weigh coins 1,2,3,4 against coins 5,6,7,8. 1.1. If they balance, then weigh coins 9 and 10 against coins 11 and 8 (we know from the first weighing that 8 is a good coin). 1.1.1. If the second weighing also balances, we know coin 12 (the only one not yet weighed) is the counterfeit. The third weighing indicates whether it is heavy or light. 1.1.2. If (at the second weighing) coins 11 and 8 are heavier than coins 9 and 10, either 11 is heavy or 9 is light or 10 is light. Weigh 9 against 10. If they balance, 11 is heavy. If they don't balance, you know that either 9 or 10 is light, so the top coin is the fake. 1.1.3 If (at the second weighing) coins 11 and 8 are lighter than coins 9 and 10, either 11 is light or 9 is heavy or 10 is heavy. Weigh 9 against 10. If they balance, 11 is light. If they don't balance, you know that either 9 or 10 is heavy, so the bottom coin is the fake. 1.2. Now if (at first weighing) the side with coins 5,6,7,8 are heavier than the side with coins 1,2,3,4. This means that either 1,2,3,4 is light or 5,6,7,8 is heavy. Weigh 1,2, and 5 against 3,6, and 9. 1.2.1. If (when we weigh 1,2, and 5 against 3,6 and 9) they balance, it means that either 7 or 8 is heavy or 4 is light. By weighing 7 and 8 we obtain the answer, because if they balance, then 4 has to be light. If 7 and 8 do not balance, then the heavier coin is the counterfeit. 1.2.2. If (when we weigh 1,2, and 5 against 3,6 and 9) the right side is heavier, then either 6 is heavy or 1 is light or 2 is light. By weighing 1 against 2 the solution is obtained. 1.2.3. If (when we weigh 1,2, and 5 against 3, 6 and 9) the right side is lighter, then either 3 is light or 5 is heavy. By weighing 3 against a good coin the solution is easily arrived at. 1.3 If (at the first weighing) coins 1,2,3,4 are heavier than coins 5,6,7,8 then repeat the previous steps 1.2 through 1.2.3 but switch the numbers of coins 1,2,3,4 with 5,6,7,8.
4. The Trainee Technician A 120 wire cable has been laid firmly underground between two telephone exchanges located 10km apart. Unfortunately after the cable was laid it was discovered to be the wrong type, the problem is the individual wires are not labeled. There is no visual way of knowing which wire is which and thus connections at either end is not immediately possible. You are a trainee technician and your boss has asked you to identify and label the wires at both ends without ripping it all up. You have no transport and only a battery and light bulb to test continuity. You do have tape and pen for labeling the wires. What is the shortest distance in kilometers you will need to walk to correctly identify and label each wire? Guess: Guess | Show Hint Show Solution | Comments (14) Hint: Creating a single loop will only help you identify all the wires by walking 40km. You need to group them in a rather odd matrix. Solution: 20. At one end label a wire "A". Then join two wire and label them both "B', then tie three (not already joined) wires together and call them each "C"....continue until all the wires are joined together in groups of 1, 2, 3, 4, 5, etc....for a 120 strand cable. NOTES that the largest group will have 15 wires. Now walk to the other end. Using a (battery and light bulb) it is now possible, for example, to find the wire that wasn't joined to any of the others. It is similarly possible to find which wires are in a pair, which is joined in a group of 3, etc. Each time a group is found the technician should label it with the letter for the group, so the single wire is labeled 'a', the pair are each labeled "A", etc....this now matches the other end.....the letters will go up to "O". Now take "A", "B", up to "O" and join them together in a group and label each one with "15", so we have cable "A15", "B15', "C15", up to "O15". Take the second and last "B'"wire and join it with a remaining "C", "D", up to "O" and label these each "14' so we have "B14", "C14", up to "O14". Repeat this until at the end there will be a single "O" cabled labeled "O1". Now walk to the other end. Now untie all the old connections and identify the group labeled "1", "2", "3" ..."15" at which point each wire at each end has a unique classification. Alternative solution from citrog: First, tie the 120 wires together randomly in 60 pairs. Next, go to the far end, randomly label any wire 1, and connect the battery to it. Test which other wire is tied to it at the starting end, and label that wire 2. Then pick another wire other than 1 or 2, label it 3, and tie it to 2, so now the battery is connected to 1, which is tied to 2 at the other end, which is tied to 3 at the end you're at. Now test which wire is tied to 3 at the other end, and label that 4, etc. What you will wind up with is all 120 wires tied to each other in a continuous sequence. Then go back to the end you started at, leaving the battery behind, connected to wire 1. Before you untie all the wires at the starting point, label each wire so that you know which wire was paired with which. Now with all the wires untied at the starting point, test which wire is connected to the battery, and label that 1. Whichever wire was in the same pair as 1, label that 2, and then tie 1 and 2 back together. Now you can find 3, because it's tied to 2 on the far end. Once you find 3, label the wire it was tied to 4, etc. This assumes that the resistance of the wire is small enough that the battery will still light the bulb across 12,000 km of wire.
5. The Card Trick I ask Alex to pick any 5 cards out of a deck with no Jokers. He can inspect then shuffle the deck before picking any five cards. He picks out 5 cards then hands them to me (Peter can't see any of this). I look at the cards and I pick 1 card out and give it back to Alex. I then arrange the other four cards in a special way, and give those 4 cards all face down, and in a neat pile, to Peter. Peter looks at the 4 cards i gave him, and says out loud which card Alex is holding (suit and number). How? The solution uses pure logic, not sleight of hand. All Peter needs to know is the order of the cards and what is on their face, nothing more. Show Hint Show Solution | Comments (11) Hint: There are only 4 suits, so there will be at least two cards of one suit, one higher and another lower. By careful selection and placement the cards can be used to encode the exact number and suit of the selected card. Solution: Pick out two cards of the same suit. Select a card for Alex where adding a number no greater than six will result in the number of the other card of the same suit. Adding one to the Ace would cycle to the beginning again and result in a Two. E.g. if you have a King and a Six of Diamonds, hand the King to Alex. The other three cards will be used to encode a number from 1 through 6. Devise a system with Peter to rank all cards uniquely from 1 to 52 (e.g. the two of hearts is 1, the two of diamonds is fourteen etc...). That will allow you to choose from six combinations, depending on where you put the lowest and highest cards.
6. The Warden The warden meets with 23 new prisoners when they arrive. He tells them, "You may meet today and plan a strategy. But after today, you will be in isolated cells and will have no communication with one another. "In the prison is a switch room, which contains two light switches labeled 1 and 2, each of which can be in either up or the down position. I am not telling you their present positions. The switches are not connected to anything. "After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him to the switch room. This prisoner will select one of the two switches and reverse its position. He must flip one switch when he visits the switch room, and may only flip one of the switches. Then he'll be led back to his cell. "No one else will be allowed to alter the switches until I lead the next prisoner into the switch room. I'm going to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and come back. I will not touch the switches, if I wanted you dead you would already be dead. "Given enough time, everyone will eventually visit the switch room the same number of times as everyone else. At any time, anyone may declare to me, 'We have all visited the switch room.' "If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you will all die horribly. You will be carefully monitored, and any attempt to break any of these rules will result in instant death to all of you" What is the strategy they come up with so that they can be free? Show Hint Show Solution | Comments (34) Hint: Take a long-term perspective. Solve the puzzler for three prisoners. Solution: The team nominates a leader. The group agrees upon the following rules: The leader is the only person who will announce that everyone has visited the switch room. All the prisoners (except for the leader) will flip the first switch up at their very first opportunity, and again on the second opportunity. If the first switch is already up, or they have already flipped the first switch up two times, they will then flip the second switch. Only the leader may flip the first switch down, if the first switch is already down, then the leader will flip the second switch. The leader remembers how many times he has flipped the first switch down. Once the leader has flipped the first switch down 44 times, he announces that all have visited the room. It does not matter how many times a prisoner has visited the room, in which order the prisoners were sent or even if the first switch was initially up. Once the leader has flipped the switch down 44 times then the leader knows everyone has visited the room. If the switch was initially down, then all 22 prisoners will flip the switch up twice. If the switch was initially up, then there will be one prisoner who only flips the switch up once and the rest will flip it up twice. The prisoners can not be certain that all have visited the room after the leader flips the switch down 23 times, as the first 12 prisoners plus the leader might be taken to the room 24 times before anyone else is allowed into the room. Because the initial state of the switch might be up, the prisoners must flip the first switch up twice. If they decide to flip it up only once, the leader will not know if he should count to 22 or 23. In the example of three prisoners, the leader must flip the first switch down three times to be sure all prisoners have visited the room, twice for the two other prisoners and once more in case the switch was initially up.
101. The Three Gods (True, False, and Random) Three gods — A, B and C — are, in some unknown order, the gods True, False and Random. True always speaks truthfully. False always speaks falsely. Random answers completely at random; each time he is asked a question he independently chooses to tell the truth or to lie. You may ask up to three yes–no questions in total. Each question must be addressed to exactly one god (the same god may be questioned more than once, and some god might not be questioned at all). Your goal is to determine which god is which. The gods understand English but will reply in their own language, in which their words for yes and no are “da” and “ja” — you do not know which word means which. Questions may depend on earlier answers; you may use the words “da” and “ja” in your questions, but of course you do not know which is which. What questions can you ask to determine the identity of each god? Show Hint Show Solution | Comments (16) Hint: Try to build a question whose answer is predictable even if Random is the one who answers it. One classic trick is to embed one question inside another, e.g. “If I were to ask you X, would you say da?” Solution: Label the gods A, B, C in the order they stand. Our first step is to force the answer to ignore Random’s behavior. Let us use the following helper idea. Key trick — the double question: The expression “If I were to ask you ‘Is P true?’ would you say da?” behaves like a normal yes–no question whose answer we can interpret safely. Whatever “da” means, a truthful god will answer da precisely when the embedded proposition P is true, and a lying god will answer da precisely when P is false. Random may still answer arbitrarily, but when Random is not being asked, we are shielded from lies by this device. Step 1. Ask God A: Q1: “If I were to ask you ‘Are you Random?’ would you say da?” If A answers da, then either A is True/False and is Random (impossible), or A is Random. Therefore: If the answer is da, A is Random. If the answer is ja, A is not Random (so Random is either B or C). We now split on these two possibilities. Case 1: A is Random (Q1 answered da) We must determine which of B and C is True. Direct all remaining questions to one of them, say B. Because we are no longer addressing Random, B will respond consistently. Q2 to B: “If I were to ask you ‘Is C Random?’ would you say da?” If the reply is da, then C is Random (hence B is either True or False). But we already know A is Random, so this cannot be; therefore the reply must be ja, telling us that C is not Random. Hence C is False and B is True. (The symmetric reasoning works if the other word meanings are swapped.) Finally, Q3 is unnecessary — we have the gods identified. Case 2: A is not Random (Q1 answered ja) So Random is B or C, and A is a consistent god (True or False). Q2 to A: “If I were to ask you ‘Is B Random?’ would you say da?” If the answer is da, then (for the same reasons as before) B is Random. If the answer is ja, then B is not Random, so C is Random. Assume the da answer (B is Random); the other branch is symmetric with B and C swapped. Now C is a consistent god. Ask C: Q3 to C: “If I were to ask you ‘Are you True?’ would you say da?” The answer da identifies C as True (and therefore A as False). The answer ja identifies C as False (and A as True). In every branch we have used no more than three questions and always learn which god is which. Therefore the puzzle is solved.
102. Two-Orb Drop from a 100-Story Building You are given two identical crystal orbs and access to a 100-story building. An orb dropped from some floors may survive the fall, while from higher floors it will shatter. There is a highest "safe" floor F (0 ≤ F ≤ 100) such that the orb does not break if dropped from any floor ≤ F and does break from any floor > F.Your task is to determine F using the fewest orb drops possible in the worst case. You may break both orbs during the process, provided you can still identify the exact value of F.What is the minimum possible maximum number of drops required, and how should you schedule the drops to achieve this? Show Hint Show Solution | Comments (30) Hint: Try making the first orb jumps of decreasing size so that, no matter where it breaks, the total number of drops (first orb so far + second-orb search) is the same. Solution: The fewest drops required in the worst case is 14.Let the first orb be dropped successively from floors spaced 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 floors apart. Concretely, drop it from floors:14, 27 (14+13), 39 (+12), 50 (+11), 60 (+10), 69 (+9), 77 (+8), 84 (+7), 90 (+6), 95 (+5), 99 (+4), 102 (+3) – but we only need up to floor 100, so stop there. (The final two theoretical steps of +2 and +1 are automatically covered.)There are two cases:If the first orb never breaks, F = 100 and you have used 14 drops.If it breaks on some floor, suppose it broke on the k-th drop. At that moment you have used k drops, and you know the highest safe floor lies between the previous safe floor and the current one – an interval whose length is at most 14 − k. Now use the second orb to test each floor within that interval sequentially from the bottom up. In the worst case this costs another 14 − k drops, bringing the total to k + (14 − k) = 14.Thus, no matter where the critical floor lies, you will never exceed 14 drops.Why 14 is optimalThe sum 14 + 13 + ⋯ + 1 = 105 ≥ 100 guarantees every floor is reachable in at most 14 drops. If you tried to finish in only 13 drops, the maximum number of distinct outcomes (the 13 triangular number) would cover at most 91 floors, insufficient for 100. Therefore 14 is the minimum possible.
103. Sultan and His Princess A wily young man wishes to marry the princess Arlena. Unfortunately, her father, the Sultan, is opposed to the marriage and is willing to buy the young man off. The Sultan, therefore makes the young man the following offer--"You get to make one statement. If the statement is false, you will be put to death and receive none of the following three things. If the statement is true, you may have one of the following three things, but I get to choose! The three things are: (1) Arlena's hand in marriage; (2) A cup filled with extremely valuable diamonds; (3) A magic lamp with a genie (who, unfortunately, cannot do marriages)." The wily young man, however, is too wily for his future father-in-law. He makes a statement such that the only way the Sultan can keep his promise is by giving the young man Arlena's hand in marriage. What was the statement? Show Solution | Comments (15) Solution: The young man could say, 'If you do not let me marry your daughter, I will be put to death.' If the Sultan chooses to give him the diamonds or the genie, the statement becomes true, and he must be executed, creating a paradox. Therefore, the only resolution is for the Sultan to give him Arlena's hand in marriage.
105. Out of 52 Cards 13 Are up and 39 Are Down and Are Mixed Out of 52 cards 13 are up and 39 are down and are mixed . How to arrange them in two decks of equal numbers of up. Condition You are sitting in a dark room and there is no light. Show Solution | Comments (5) Solution: Separate the cards into two piles: one with 13 cards and the other with 39 cards. Flip all the cards in the pile of 13. This way, if the pile of 39 has x face-up cards, the pile of 13 will have 13-x face-up cards, and flipping it will result in both piles having x face-up cards.
106. Dotted Dwarfs The leader of a group of dwarfs wants to test his group. So at night he paints on the back of each dwarf a dot, either red of blue. The next morning he let's the dwarfs gather at a meeting point and tell's them the rules of the game: You may never know what the color of your own dot is. (This is accomplished by saying they may not communicate in any way or use mirrors and such) He will give them a few minutes to discuss a tactic to solve the puzzle. The goal is that the number of dwarfs with a red dot, assume this number is X, on their back gather at the same meetingpoint the number of days, X, after the start of the game. for example if there are 10 red dots, after 10 days they must gather Any other entry upon the meetingpoint of any dwarf results in failure. Now, how must every dwarf think to solve the puzzle? Show Solution | Comments (17) Solution: Each dwarf will observe the number of red dots on the backs of the other dwarfs. If a dwarf sees Y red dots, they will assume that the total number of red dots, X, is either Y (if their own dot is blue) or Y + 1 (if their own dot is red). Therefore, they will wait for X days. If no one gathers after Y days, it indicates that they must have a red dot themselves, and they will gather on the Xth day. This way, all dwarfs with red dots will gather at the correct time.
111. Optimal Strategy for the Crystal-Ball Drop You have m identical crystal balls and access to an n–storey building. A drop from any floor produces one of two outcomes:the ball survives intact, orthe ball shatters beyond further use.Your task is to determine, with as few drops as possible in the worst case, the highest floor F such that a ball dropped from floor F does not break.(A drop from any floor higher than F will always break the ball.)Assume n > m and that every ball behaves identically. What strategy minimises the maximum number of drops, and how many drops are required in the worst case? Show Hint Show Solution | Comments (6) Hint: Think of the problem backwards: if you are allowed at most k drops and still have b balls left, how many floors can you distinguish between? Work out a recurrence for that quantity. Solution: Let T(b, r) be the maximum number of floors that can be resolved using b balls and at most r remaining drops. One final drop either leaves the ball intact (so we can still use b balls and now have r − 1 drops) or breaks it (leaving b − 1 balls and r − 1 drops). HenceT(b, r) = 1 + T(b, r − 1) + T(b − 1, r − 1), with T(0, r) = 0, T(b, 0) = 0.Solving this recurrence givesT(b, r) = \(\displaystyle \sum_{i=0}^{b} \binom{r}{i}\).Therefore, if we are allowed r drops we can cope with at most \(\sum_{i=0}^{m} \binom{r}{i}\) floors. Conversely, the minimum worst-case number of drops, call it k, is the smallest integer satisfying\(\displaystyle \sum_{i=0}^{m} \binom{k}{i} \;\ge\; n.\)Strategy (constructive): keep two counters, b (balls left, initially m) and r (drops left, initially k). After having already proved safe the highest floor saf, computestep = 1 + \(\displaystyle \sum_{i=0}^{b-1} \binom{r-1}{i}\).Move up step floors from saf and drop a ball there.If it breaks, set b ← b − 1; if it survives, set saf to that floor. In both cases set r ← r − 1 and repeat until either all floors are resolved or no balls remain.This procedure guarantees that no matter how the drops turn out we will never require more than k drops, and k is the smallest number for which such a guarantee is possible. Hence the puzzle’s answer is:Minimum worst-case drops = smallest k with \(\sum_{i=0}^{m} \binom{k}{i} \ge n.\)Examples:m = 1 (one ball): need k = n drops → linear search.m = 2, n = 100: smallest k is 14 (since 14·15/2 = 105 ≥ 100).Thus the presented strategy is optimal.
112. Coins on a Chessboard A warden takes prisoner A into a room containing a chessboard, on each square of which is a coin randomly showing heads or tails. He then indicates a random square on that board. Prisoner A is given the chance to flip one coin (or none), then taken from the room, after which prisoner B is taken into the room and must say which square the warden indicated. The two prisoners may strategize beforehand, but may not communicate during the trial (except with the single coin flip). What should be their strategy? Show Solution | Comments (2) Solution: The prisoners can use the parity of the number of heads on the chessboard to communicate the indicated square. They agree that if the indicated square is (x, y) and the total number of heads is even, prisoner A will flip the coin at (x, y) to tails; if odd, he will leave it as is. Prisoner B can then determine the indicated square based on the parity of heads after A's action. This strategy can be extended to larger boards, but the patterns may become more complex.
113. Colored Hats A warden lines up a group of 30 prisoners so they can see everybody in front of them and nobody behind them, then places either a red or a blue hat on each of their heads, randomly. He then goes from the back of the line to the front, telling each prisoner to guess the color of their own hat. Each who guesses correctly is freed. The prisoners cannot see the color of their own hat, and cannot communicate with each other, but can hear each others' guesses and can strategize beforehand. What strategy saves the greatest number of prisoners? Show Solution | Comments (0) Solution: The prisoners can use the parity of the number of red hats they see in front of them to communicate. The last prisoner in line counts the number of red hats in front of him and announces 'red' if the count is odd and 'blue' if it is even. Each subsequent prisoner can then deduce their own hat color based on the previous guesses and the number of red hats they see, allowing at least 29 prisoners to be freed with certainty.
114. Numbered Hats A warden places a hat on the head of each of 100 prisoners, each with a random number from 1 to 100. There may be duplicates. Each prisoner can see everybody's hat but their own. Each prisoner then guesses their own number; if any guess correctly, they all go free. The group may not communicate in any way during the trial, but may strategize beforehand. What strategy has the best chance of success? Show Solution | Comments (3) Solution: The prisoners can agree beforehand to use the sum of the visible numbers modulo 100 as a strategy. Each prisoner will calculate the total of the numbers they see, take that total modulo 100, and then subtract it from the expected total if they could see their own number. This way, each prisoner can deduce their own number based on the others' hats, maximizing the chances of at least one correct guess. Additionally, if the prisoners have a way to communicate their guesses, they can use the first guess to relay information to help others deduce their own numbers.
115. There Are 100 Prisoners. There are 100 prisoners. At random times one prisoner is chosen uniformly at random and led into a room with a single lamp. The prisoner can choose to switch it on or off or leave it as the last visiting prisoner left it. Apart from the state of the lamp he must leave the room unchanged. After visiting the room, each prisoner is asked if every prisoner has visited the room by now. If he answers 'Yes' and indeed everyone has been to the room at least once, then everybody is freed immediately. Otherwise they are all executed ;) He can answer 'I don't know' without any consequences. Apart from the lamp being on or off the prisoners have no way of communication at all, but of course as is customary in such puzzles they can plot a strategy in advance and everybody is a perfect logician. Show Solution | Comments (1) Solution: The prisoners designate one as the 'leader' (or 'counter') and the others as 'visitors.' Each visitor will turn the lamp on the first time they enter the room if it is off, and they will not touch the lamp again after that. The leader will switch the lamp off if it is on, or do nothing if it is off. The leader counts how many times they have switched the lamp off. Once the leader has switched off the lamp 99 times, they can confidently declare that all prisoners have visited the room at least once. This strategy assumes the lamp starts in the off position; if the initial state is unknown, the logic remains similar but requires adjustment in the counting method.
116. Names in Boxes The names of 100 prisoners are placed in 100 wooden boxes, one name to a box, and the boxes are lined up on a table in a room. One by one, the prisoners are led into the room; each may look in at most 50 boxes, but must leave the room exactly as he found it and is permitted no further communication with the others. The prisoners have a chance to plot their strategy in advance, and they are going to need it, because unless every single prisoner finds his own name all will subsequently be executed. Find a strategy for them which which has probability of success exceeding 30%. Show Solution | Comments (1) Solution: The prisoners can use a strategy based on the numbers associated with their names. Each prisoner starts by opening the box with their own number. If they find their name, they succeed; if not, they take the number found in that box and open the box with that number. They repeat this process for up to 50 boxes. This strategy leverages the structure of permutations, forming chains of boxes that lead back to the starting box. If the chain is shorter than 50 boxes, the prisoner will find their name within the limit. The probability of success, based on the random arrangement of names in the boxes, is approximately 31.8%, as no chains exceed 50 boxes in length.
119. Cannibal's Final Statement You were hiking in a remote jungle when you got caught by logic-loving cannibals. The chief of the cannibals said to you, "You may now make one last statement. If your statement is true, we will burn you at the stake. If your statement is false, we will boil you in oil." What statement should you say so that the cannibals have no choice but to let you go? Show Hint Show Solution | Comments (0) Hint: Consider the implications of your statement being true or false. Solution: You should say, "You will boil me in oil." If this statement is true, they must burn you at the stake, which makes it false. If it is false, they must boil you in oil, which makes it true. Therefore, they cannot carry out either punishment and must let you go.
120. Choosing Between Heaven and Hell A person dies and he is being asked by God that there are two ways: one towards heaven and one towards hell. In hell, the devil is standing, and in heaven, the angel is there. But he is not aware of who is the angel and who is the devil. So he has to ask a question to either of them so that he can enter the way towards heaven. What should he ask? Show Hint Show Solution | Comments (0) Hint: Consider asking a question that reveals the truth regardless of whom you are asking. Solution: He should ask either of them, 'If I were to ask the other one which way leads to heaven, what would he say?' Then he should take the opposite path.
121. Dwarfs and Colored Dots I have a riddle no one has asked before. It's about dwarfs. The leader of a group of dwarfs wants to test his group. So at night he paints on the back of each dwarf a dot, either red or blue. The next morning he lets the dwarfs gather at a meeting point and tells them the rules of the game:1. You may never know what the color of your own dot is. (This is accomplished by saying they may not communicate in any way or use mirrors and such)2. He will give them a few minutes to discuss a tactic to solve the puzzle.3. The goal is that the number of dwarfs with a red dot, assume this number is X, on their back gather at the same meeting point the number of days, X, after the start of the game. For example, if there are 10 red dots, after 10 days they must gather.4. Any other entry upon the meeting point of any dwarf results in failure.5. The dwarfs are told there is at least one red dot.Now, how must every dwarf think to solve the puzzle? Show Solution | Comments (0) Solution: The tactic is:Each dwarf counts how many red dots he can see on the others. Call that number r.Then he follows this rule:“If nobody has gone to the meeting point before, I will go on day r + 1.”Why it works, assuming everyone publicly knows there is at least one red dot:Day 1:A red dwarf who sees 0 red dots knows he must be the only red. So he goes on day 1.Day 2:If there are 2 red dwarfs, each sees 1 red. Each thinks: “Maybe I am blue, and the other red dwarf sees 0 red dots. If so, he would go on day 1.” Nobody goes on day 1, so each realizes: “I must also be red.” Both go on day 2.Day 3:If there are 3 red dwarfs, each sees 2 red. Each thinks: “If I am blue, those 2 red dwarfs would figure it out and go on day 2.” Nobody goes on day 2, so each realizes he is red. All 3 go on day 3.And so on.So if there are X red dwarfs, each red dwarf sees X − 1 red dots, waits through the first X − 1 days, then goes on day X.Blue dwarfs see X red dots, so their rule would make them wait until day X + 1. But the red dwarfs already correctly gather on day X, so the game is solved.Important catch: if the dwarfs are not told that at least one red dot exists, the puzzle is impossible. A lone red dwarf seeing zero red dots cannot distinguish “I am red” from “everyone is blue.”
123. The Warden's Game A warden has a group of prisoners. He promises to pick each prisoner at random to visit the switch room, ensuring that eventually, each prisoner will visit the room the same number of times. However, he also states, 'I intend to keep this game going, till infinity.' Show Solution | Comments (0) Solution: The promise is impossible: with random, independent selection, the numbers of visits almost surely never all tie, so the warden cannot ever make each prisoner visit the switch room the same number of times.