Logic riddles

logic

King's jester in Medieval England

In medieval England, a king's jester was imprisoned (the king didn't like the jester's jokes). The jester was locked in a room at the top of a high tower. The room had only one tiny window. The jester found a piece of rope. It wasn't long enough to reach the ground. So, he divided it in half and tied the two halves together. This made the rope long enough and he escaped. How?
He divided the rope vertically, not horizontally.
93.55 %
39 votes

logic

Wires, batteries and lightbulbs

You are standing in a house in the middle of the countryside. There is a small hole in one of the interior walls of the house, through which 100 identical wires are protruding. From this hole, the wires run underground all the way to a small shed exactly 1 mile away from the house, and are protruding from one of the shed's walls so that they are accessible from inside the shed. The ends of the wires coming out of the house wall each have a small tag on them, labeled with each number from 1 to 100 (so one of the wires is labeled "1", one is labeled "2", and so on, all the way through "100"). Your task is to label the ends of the wires protruding from the shed wall with the same number as the other end of the wire from the house (so, for example, the wire with its end labeled "47" in the house should have its other end in the shed labeled "47" as well). To help you label the ends of the wires in the shed, there are an unlimited supply of batteries in the house, and a single lightbulb in the shed. The way it works is that in the house, you can take any two wires and attach them to a single battery. If you then go to the shed and touch those two wires to the lightbulb, it will light up. The lightbulb will only light up if you touch it to two wires that are attached to the same battery. You can use as many of the batteries as you want, but you cannot attach any given wire to more than one battery at a time. Also, you cannot attach more than two wires to a given battery at one time. (Basically, each battery you use will have exactly two wires attached to it). Note that you don't have to attach all of the wires to batteries if you don't want to. Your goal, starting in the house, is to travel as little distance as possible in order to label all of the wires in the shed. You tell a few friends about the task at hand. "That will require you to travel 15 miles!" of of them exclaims. "Pish posh," yells another. "You'll only have to travel 5 miles!" "That's nonsense," a third replies. "You can do it in 3 miles!" Which of your friends is correct? And what strategy would you use to travel that number of miles to label all of the wires in the shed?
Believe it or not, you can do it travelling only 3 miles! The answer is rather elegant. Starting from the house, don't attach wires 1 and 2 to any batteries, but for the remaining wires, attach them in consecutive pairs to batteries (so attach wires 3 and 4 to the same battery, attach wires 5 and 6 to the same battery, and so on all the way through wires 99 and 100). Now travel 1 mile to the shed, and using the lightbulb, find all pairs of wires that light it up. Put a rubberband around each pair or wires that light up the lightbulb. The two wires that don't light up any lightbulbs are wires 1 and 2 (though you don't know yet which one of them is wire 1 and which is wire 2). Put a rubberband around this pair of wires as well, but mark it so you remember that they are wires 1 and 2. Now go 1 mile back to the house, and attach odd-numbered wires to batteries in the following pairs: (1 and 3), (5 and 7), (9 and 11), and so on, all the way through (97 and 99). Similarly, attach even-numbered wires to batteries in the following pairs: (4 and 6), (8 and 10), (12 and 14), and so on, all the way through (96 and 98). Note that in this round, we didn't attach wire 2 or wire 100 to any batteries. Finally, travel 1 mile back to the shed. You're now in a position to label all of the wires here. First, remember we know the pair of wires that are, collectively, wires 1 and 2. So test wires 1 and 2 with all the other wires to see what pair lights up the lightbulb. The wire from wires 1 and 2 that doesn't light up the bulb is wire 2 (which, remember, we didn't connect to a battery), and the other is wire 1, so we can label these as such. Furthermore, the wire that, with wire 1, lights up a lightbulb, is wire 3 (remember how we connected the wires this round). Now, the other wire in the rubber band with wire 3 is wire 4 (we know this from the first round), and the wire that, with wire 4, lights up the lightbulb, is wire 6 (again, because of how we connected the wires to batteries this round). We can continue labeling batteries this way (next we'll label wire 7, which is rubber-banded to wire 6, and then we'll label wire 9, which lights up the lightbulb with wire 7, and so on). At the end, we'll label wire 97, and then wire 99 (which lights up the lightbulb with wire 97), and finally wire 100 (which isn't connected to a battery this round, but is rubber-banded to wire 99). And we're done, having travelled only 3 miles!
93.84 %
41 votes

logic

3 Lightbulb switches

There are 3 switches outside of a room, all in the 'off' setting. One of them controls a lightbulb inside the room, the other two do nothing. You cannot see into the room, and once you open the door to the room, you cannot flip any of the switches any more. Before going into the room, how would you flip the switches in order to be able to tell which switch controls the light bulb?
Flip the first switch and keep it flipped for five minutes. Then unflip it, and flip the second switch. Go into the room. If the lightbulb is off but warm, the first switch controls it. If the light is on, the second switch controls it. If the light is off and cool, the third switch controls it.
94.11 %
43 votes

logic

Coins on a table

Your friend pulls out a perfectly circular table and a sack of quarters, and proposes a game. "We'll take turns putting a quarter on the table," he says. "Each quarter must lay flat on the table, and cannot sit on top of any other quarters. The last person to successfully put a quarter on the table wins." He gives you the choice to go first or second. What should you do, and what should your strategy be to win?
You should go first, and put a quarter at the exact center of the table. Then, each time your opponent places a quarter down, you should place your next quarter in the symmetric position on the opposite side of the table. This will ensure that you always have a place to set down our quarter, and eventually your oppponent will run out of space.
94.36 %
45 votes

logic

Twelve balls, one different

You have twelve balls, identical in every way except that one of them weighs slightly less or more than the balls. You have a balance scale, and are allowed to do 3 weighings to determine which ball has the different weight, and whether the ball weighs more or less than the other balls. What process would you use to weigh the balls in order to figure out which ball weighs a different amount, and whether it weighs more or less than the other balls?
Take eight balls, and put four on one side of the scale, and four on the other. If the scale is balanced, that means the odd ball out is in the other 4 balls. Let's call these 4 balls O1, O2, O3, and O4. Take O1, O2, and O3 and put them on one side of the scale, and take 3 balls from the 8 "normal" balls that you originally weighed, and put them on the other side of the scale. If the O1, O2, and O3 balls are heavier, that means the odd ball out is among these, and is heavier. Weigh O1 and O2 against each other. If one of them is heavier than the other, this is the odd ball out, and it is heavier. Otherwise, O3 is the odd ball out, and it is heavier. If the O1, O2, and O3 balls are lighter, that means the odd ball out is among these, and is lighter. Weigh O1 and O2 against each other. If one of them is lighter than the other, this is the odd ball out, and it is lighter. Otherwise, O3 is the odd ball out, and it is lighter. If these two sets of 3 balls weigh the same amount, then O4 is the odd ball out. Weight it against one of the "normal" balls from the first weighing. If O4 is heavier, then it is heavier, if it's lighter, then it's lighter. If the scale isn't balanced, then the odd ball out is among these 8 balls. Let's call the four balls on the side of the scale that was heavier H1, H2, H3, and H4 ("H" for "maybe heavier"). Let's call the four balls on the side of the scale that was lighter L1, L2, L3, and L4 ("L" for "maybe lighter"). Let's also call each ball from the 4 in the original weighing that we know aren't the odd balls out "Normal" balls. So now weigh [H1, H2, L1] against [H3, L2, Normal]. -If the [H1, H2, L1] side is heavier (and thus the [H3, L2, Normal] side is lighter), then this means that either H1 or H2 is the odd ball out and is heavier, or L2 is the odd ball out and is lighter. -So measure [H1, L2] against 2 of the "Normal" balls. -If [H1, L2] are heavier, then H1 is the odd ball out, and is heavier. -If [H1, L2] are lighter, then L2 is the odd ball out, and is lighter. -If the scale is balanced, then H2 is the odd ball out, and is heavier. -If the [H1, H2, L1] side is lighter (and thus the [H3, L2, Normal] side is heavier), then this means that either L1 is the odd ball out, and is lighter, or H3 is the odd ball out, and is heavier. -So measure L1 and H3 against two "normal" balls. -If the [L1, H3] side is lighter, then L1 is the odd ball out, and is lighter. -Otherwise, if the [L1, H3] side is heavier, then H3 is the odd ball out, and is heavier. If the [H1, H2, L1] side and the [H3, L2, Normal] side weigh the same, then we know that either H4 is the odd ball out, and is heavier, or one of L3 or L4 is the odd ball out, and is lighter. So weight [H4, L3] against two of the "Normal" balls. If the [H4, L3] side is heavier, then H4 is the odd ball out, and is heavier. If the [H4, L3] side is lighter, then L3 is the odd ball out, and is lighter. If the [H4, L3] side weighs the same as the [Normal, Normal] side, then L4 is the odd ball out, and is lighter.
94.36 %
45 votes

logic

Engineers and Managers

You have just purchased a small company called Company X. Company X has N employees, and everyone is either an engineer or a manager. You know for sure that there are more engineers than managers at the company. Everyone at Company X knows everyone else's position, and you are able to ask any employee about the position of any other employee. For example, you could approach employee A and ask "Is employee B an engineer or a manager?" You can only direct your question to one employee at a time, and can only ask about one other employee at a time. You're allowed to ask the same employee multiple questions if you want. Your goal is to find at least one engineer to solve a huge problem that has just hit the company's factory. The problem is so urgent that you only have time to ask N-1 total questions. The major problem with questioning the employees, however, is that while the engineers will always tell you the truth about other employees' roles, the managers may lie to you if they like. You can assume that the managers will do their best to confuse you. How can you find at least one engineer by asking at most N-1 questions?
You can find at least one engineer using the following process: Put all of the employees in a conference room. If there happen to be an even number of employees, pick one at random and send him home for the day so that we start with an odd number of employees. Note that there will still be more engineers than managers after we send this employee home. Then call them out one at a time in any order. You will be forming them into a line as follows: If there is nobody currently in the line, put the employee you just called out in the line. Otherwise, if there is anybody in the line, then we do the following. Let's call the employee currently at the front of the line Employee_Front, and call the employee who we just called out of the conference room Employee_Next. So ask Employee_Front if Employee_Next is a manager or an engineer. If Employee_Front says "manager", then send both Employee_Front and Employee_Next home for the day. However, if Employee_Front says "engineer", then put Employee_Next at the front of the line. Keep doing this until you've called everyone out of the conference room. Notice that at this point, you'll have asked N-1 or less questions (you asked at most one question each time you called an employee out except for the first employee, when you didn't ask a question, so that's at most N-1 questions). When you're done calling everyone out of the conference room, the person at the front of the line is an engineer. So you've found your engineer! But the real question: how does this work? We can prove this works by showing a few things. First, let's show that if there are any engineers in the line, then they must be in front of any managers. We'll show this with a proof by contradiction. Assume that there is a manager in front of an engineer somewhere in the line. Then it must have been the case that at some point, that engineer was Employee_Front and that manager was Employee_Next. But then Employee_Front would have said "manager" (since he is an engineer and always tells the truth), and we would have sent them both home. This contradicts their being in the line at all, and thus we know that there can never be a manager in front of an engineer in the line. So now we know that after the process is done, if there are any engineers in the line, then they will be at the front of the line. That means that all we have to prove now is that there will be at least one engineer in the line at the end of the process, and we'll know that there will be an engineer at the front. So let's show that there will be at least one engineer in the line. To see why, consider what happens when we ask Employee_Front about Employee_Next, and Employee_Front says "manager". We know for sure that in this case, Employee_Front and Employee_Next are not both engineers, because if this were the case, then Employee_Front would have definitely says "engineer". Put another way, at least one of Employee_Front and Employee_Next is a manager. So by sending them both home, we know we are sending home at least one manager, and thus, we are keeping the balance in the remaining employees that there are more engineers than managers. Thus, once the process is over, there will be more engineers than managers in the line (this is also sufficient to show that there will be at least one person in the line once the process is over). And so, there must be at least one engineer in the line. Put altogether, we proved that at the end of the process, there will be at least one engineer in the line and that any engineers in the line must be in front of any managers, and so we know that the person at the front of the line will be an engineer.
93.84 %
41 votes

logic

Measuring Gallons of Water

You have two jugs, one that holds exactly 3 gallons, and one that holds exactly 5 gallons. Using just these two jugs and a fire hose, how can you measure out exactly 4 gallons of water?
Fill the 5-gallon jug to the top, and then pour it into the 3-gallon jug until the 3-gallon jug is full. You now have 2 gallons remaining in the 5-gallon jug. Pour out the 3-gallon jug, and then pour the 2 gallons from the 5-gallon jug into the 3-gallon jug. Finally, fill the 5-gallon jug to the top and pour it into the 3-gallon jug until it's full. Since there was only space left for 1 more gallon in the 3-gallon jug, you now have exactly 4 gallons in the 5-gallon jug.
93.39 %
38 votes

logicmath

Pizza

How can you divide a pizza into 8 equal slices using only 3 straight cuts?
Cut 1: Cut the pizza straight down the middle into two halves. Cut 2: Keeping the two halves in the place, cut the pizza straight down the middle at right angles to the first cut (you will be left with 4 equal quarters) Cut 3: Pile the 4 quarters on top of each other and cut through the middle of the pile. You will be left with 8 equal slices.
93.05 %
36 votes

logic

Egg challenge

An egg has to fall 100 feet, but it can't break upon landing (or in the air). Its fall can't be slowed down, nor can its landing be cushioned in any way. How is it done?
Drop it from more than 100 feet high. It won't break for the first 100 feet.
93.39 %
38 votes

logic

Traveling all over the world

A man named Stewart is traveling all over the world. First he travels to Cape Town in South Africa. Then to Jakarta in Indonesia. Then to Canberra in Australia. Then to Rome in Italy. Then to Panama City in Panama. Where does he travel next?
Santiago in Chile. He travels to each continent in alphabetical order then to the capital of the country that has the most southern latitude.
93.22 %
37 votes