Archive for the ‘Puzzles’ Category.

Express 6

I was given this puzzle at the last Gathering for Gardner.

Use arithmetic operations to express 6 using three identical digits. For each digit from 0 to 9 find at least one way to express 6.

For example, I can express 6 using three twos in many ways: 2 + 2 + 2, or 2 · 2 + 2, or 22 + 2. But the problem doesn’t ask for many ways. One way is enough, but you need to do it for every digit. So nine more cases to go: 0, 1, 3, 4, 5, 6, 7, 8, and 9.

Share:Facebooktwitterredditpinterestlinkedinmail

Beer Jokes and Hat Puzzles

This is one of my favorite jokes:

Three logicians walk into a bar. The waitress asks, “Do you all want beer?”
The first logician answers, “I do not know.”
The second logician answers, “I do not know.”
The third logician answers, “Yes.”

This joke reminds me of hat puzzles. In the joke each logician knows whether or not s/he wants a beer, but doesn’t know what the others want to drink. In hat puzzles logicians know the colors of the hats on others’ heads, but not the color of their own hats.

This is a hat puzzle which has the same answers as in the beer joke. Three logicians walk into a bar. They know that the hats were placed on their heads from the set of hats below. The total number of available red hats was three, and the total number of available blue hats was two.

Red Hat Red Hat Red Hat Red Hat Red Hat

Three logicians walk into a bar. The waitress asks, “Do you know the color of your own hat?'”
The first logician answers, “I do not know.”
The second logician answers, “I do not know.”
The third logician answers, “Yes.”

The puzzle is, what is the color of the third logician’s hat?

This process of converting jokes to puzzles reminds me of the Langland’s Program, which tries to unite different parts of mathematics. I would like to unite jokes and puzzles. So here I announce my own program:

Tanya’s Program: Find a way to convert jokes into puzzles and puzzles into jokes.

Share:Facebooktwitterredditpinterestlinkedinmail

The Three Light Bulbs Puzzle

There is a famous puzzle about three light bulbs, that is sometimes given at interviews.

Suppose that you are standing in a hallway next to three light switches that are all off. There is another room down the hall, where there are three incandescent light bulbs—each light bulb is operated by one of the switches in the hallway. You can’t see the light bulbs from the hallway. How would you figure out which switch operates which light bulb, if you can only go to the room with the light bulbs one and only one time?

This puzzle worked much better in the past when we only had incandescent light bulbs and so didn’t need to specify the type of bulbs. Unfortunately, the standard solution only works with incandescent bulbs and the word “incandescent” nowadays needs to be stated. But the use of “incandescent” is a big hint. Indeed, incandescent light bulbs generate heat when they are on, so the standard solution is to turn on the first light switch, to keep the second switch off, and to turn the third switch on for five minutes before turning it off. In the room, the light bulb corresponding to the first switch will be lit, and out of the two unlit bulbs, the one corresponding to the third switch will be warm.

It’s a cute solution, but there could be so many other approaches:

  • You can ask a friend to help you. You can come to the room with the light bulbs and shout to her which switch to turn on.
  • You can place mirrors from the room to the hall, so you can see bulbs through the multiple reflections. You might not need to enter the room at all.
  • Before playing with the switches, you can place a video camera in the room to transmit the scene in real time. You will not be allowed to enter the room again to get the camera back, but what the heck: the job will be done.
  • You can put timers on the switches and set them to turn on at different times.
  • You can attach strings to switches and turn them on or off from a distance.

I invite my readers to invent other methods to solve this problem. Be creative. After all, if I were to interview you for a job, I would be more impressed by a new solution than the one that is all over the Internet.

Share:Facebooktwitterredditpinterestlinkedinmail

Liars and Their Motivation

You arrive at an archipelago of many islands. On each island there are two villages. In one village truth-tellers live, and they always tell the truth. In the other village liars live, and they always lie. The islanders all know each other.

On the first island you stumbled upon three islanders and you ask each of them your question:

How many truth-tellers are there among you?

Here are their answers:

A: One.
B: A is wrong.
C: A and B are from the same village.

Can you determine who is a truth-teller and who is a liar?

This island is called a classic island, where all behave as if they were in a standard logic puzzle. It is a perfectly nice puzzle but B and C didn’t answer the question: B ratted on A, and C went on a tangent. When I was younger, I never cared about the motivations of A, B, or C. Their answers are enough to solve the puzzle. But now that I am older, I keep wondering why they would choose these particular answers over other answers. So I invented other islands to impose rules on how the villagers are allowed to answer questions.

Now you travel to the next island that is called a straightforward island, where everyone answers your question exactly. You are in the same situation, and ask the same question, with the following result:

A: One.
B: One.
C: Ten.

Can you determine who is a truth-teller and who is a liar?

Once again we wonder about their motivation. This time C told an obvious lie, an answer that is impossible. Why on earth did he say 10? Isn’t the goal of lying to deceive and confuse people? There is nothing confusing in the answer “ten.”

Now you come to the third island, which is a straightforward inconspicuous island. To answer your question, a liar wouldn’t tell you an obvious lie. For this particular situation, the liar has to choose one of the four answers that are theoretically possible: zero, one, two, or three. You are again in the same situation of asking three people how many truth-tellers are among them, and these are the answers:

A: Two.
B: Zero.
C: One.

Can you determine who is a truth-teller and who is a liar?

When you think about it, a truth-teller cannot answer zero to this question. So although zero is a theoretically possible answer, we can deduce that the person who said it is a liar. If liars are trying to confuse a stranger, and they’re smart, they shouldn’t answer “zero.”

The next island is a straightforward inconspicuous smart island. The liars on this island are smart enough not to answer zero. You are in the same situation again and ask the same question with the following outcome:

A: Two.
B: Two.
C: One.

Can you determine who is a truth-teller and who is a liar? You shouldn’t be able to. There are three possibilities. There are two truth-tellers (A and B), one truth-teller (C), or zero truth-tellers.

Let us assign probabilities to liars’ answers. Assume that liars pick their answers randomly from the subset of wrong answers out of the set: one, two, three. If two of these answers are incorrect, they pick a wrong answer with probability one half. If all three of the answers are incorrect, they pick one of them with probability one-third. Suppose the people you meet are picked at random. Suppose that the probability that a random person is a truth-teller is 1/2. Given the answers above, what is more probable: that there are two truth-tellers, one truth-teller, or zero truth-tellers?

Share:Facebooktwitterredditpinterestlinkedinmail

Ambiguities in Logic

You visit an island of three towns: Trueton, Lieberg and Alterborough. Folks living in Trueton always tell the truth. Those who live in Lieberg, always lie. People from Alterborough alternate strictly between truth and lie. You meet an islander who says:

Two plus two is five. Also, three plus three is six.

Can you determine which town he is from?

It should be easy. He made two statements: the first one is false, the second is true. So he must be from Alterborough.

But what about “also”? How should we interpret this transition? There are many ways to interpret this “also.” On one hand it could mean: In addition to the previous statement I am making another statement. On the other hand it could mean: The previous pause shouldn’t be considered as the end of the statement; the whole thing should be interpreted as one statement. Besides this person was speaking not writing. Are we sure that the first period was not meant to be a comma or a semi-colon? If we assume that the quote is one statement, then the speaker might be either a liar or an alternator.

Here is a puzzle for you from the same island:

One night a call came into 911: “Fire, help!” The operator couldn’t ID the phone number, so he asked, “Where are you calling from?” “Lieberg.” Assuming no one had overnight guests from another town, is there an emergency? If so, where should help be sent? And was it a fire?

Now find the ambiguities.

Share:Facebooktwitterredditpinterestlinkedinmail

Prepare for the Hunt

The MIT Mystery Hunt starts on Friday. My old team—Manic Sages— fell apart after last years’ hunt. My new team—Death and Mayhem—started sending us daily practice puzzle to prepare for the hunt.

Today’s puzzle was written by Paul Hlebowitsh. As usual, the answer is a word or a phrase.

Puzzle 3: Humans

“After a long day taking care of the animals, it’s good to unwind by letting the taps flow.”

Tap 1: Sierra Nevada Pale Ale
Tap 2: Lagunitas Pale Ale
Tap 3: 21st Amendment “Brew Free! or Die IPA”
Tap 4: Wachusett Blueberry
Tap 5: Harpoon UFO

Alice, Bob, Carol, Danny, Erica, Fred, and Gregario, the seven children of Noah, went to a local bar before the flood to get drinks. Accounts of night vary, and no one remembers exactly what happened, but some facts have become clear:

  1. Everyone had two drinks, in some order.
  2. Danny liked his first drink so much he had it again. Everyone else had drinks from different breweries.
  3. Erica was the only person to drink an IPA.
  4. Four people had the Wachusett Blueberry as their first drink.
  5. One person had the Sierra Nevada Pale Ale as their first drink.
  6. Alice only drank beers with headquarters in California, in order to spite Bob and Danny.
  7. Two Harpoon UFOs were ordered, as well as two Sierra Nevada Pale Ales. 8
  8. Alice’s second drink was the same as Fred’s first drink.
  9. Bob and Danny hate California and refuse to drink any beer from a company that’s headquartered there.
  10. Alice and Erica had the same first drink.
  11. Fred had a Harpoon UFO.

Who ordered which drinks and in what order?

Share:Facebooktwitterredditpinterestlinkedinmail

An Irresistible Cannonball

I gave the following puzzle from Raymond Smullyan’s book What is the Name of this Book? to my AMSA students.

What happens if an irresistible cannonball hits an immovable post?

This puzzle is known as the Irresistible Force Paradox. The standard answer is that the given conditions are contradictory and the two objects cannot exist at the same time.

My AMSA student gave me a much cuter answer: The post falls in love with the cannonball as it is so irresistible.

Share:Facebooktwitterredditpinterestlinkedinmail

Parallel Weighings Solution

I recently posted the following coin weighing puzzle invented by Konstantin Knop:

We have N indistinguishable coins. One of them is fake and it is not known whether it is heavier or lighter than all the genuine coins, which weigh the same. There are two balance scales that can be used in parallel. Each weighing lasts one minute. What is the largest number of coins N for which it is possible to find the fake coin in five minutes?

The author’s solution in Russian is available at his blog. Also, two of my readers, David Reynolds and devjoe, solved it correctly.

Here I want to explain the solution for any number of required weighings.

It is easy to see that for n weighings the information theoretical bound is 5n. Indeed, each weighing divides coins into five groups: four pans and the leftover pile. To distinguish between coins, there can’t be two coins in the same pile at every weighing.

Suppose we know the faking potential of every coin, that is, each coin is assigned a value: potentially light or potentially heavy. If a potentially light coin is ever determined to be fake, then it must be lighter than a real coin. The same story holds for potentially heavy coins. How many coins with known potential can we process in n weighings?

If all the coins are potentially light then we can find the fake coin out of 5n coins in n weighings. What if there is a mixture of coins? Can we expect the same answer? How much more complicated could it be? Suppose we have five coins: two of them are potentially light and three are potentially heavy. Then on the first scale we compare one potentially light coin with the other such coin. On the other scale we compare one potentially heavy coin against another potentially heavy coin. The fake coin can be determined in one weighing.

The discussion above shows that there is a hope that any mixture of coins with different potential can be resolved. After each weighing, we want the number of coins that are not determined to be real to be reduced by a factor of 5. If one of the weighings on one scale is unbalanced, the potentially light coins on the lighter pan, plus the potentially heavy coins on the heavier pan would contain the fake coin. We do not want this number to be bigger than one-fifth of the total number of coins we are processing. So we divide coins in pairs with the same potential, and from each pair we put the coins on different pans of the same scale. So in one weighing we can divide the group into five equal groups. If there is an odd number of coins with the same potential, then the extra coin doesn’t go on the scales.

The only thing that we is left to check is what happens if the number of coins is small. Namely, we need to check what happens when the number of potentially light coins is odd and the number of potentially heavy coins is odd, and the total number of coins is not more than five. In this case the algorithm requires us to put aside the extra coin in each group, but the put-aside pile can’t have more than one coin.

After checking small cases, we see that we can’t resolve the problem in one weighing when there are 2 coins of different potential, or when the 4 coins are distributed as 1 and 3.

On the other hand, if we have extra coins that are known to be real, then the above cases can be resolved. Hence, any number of coins with known potential greater than four can be resolved in ⌈log5n⌉ weighings.

Now let’s go back to the original problem in which we do not know the coins’ potential at the start. After a weighing, if both scales balance, then all the coins on the scale are real and the fake coin is in the leftover pile and we do not know its potential. If a scale doesn’t balance then the fake coin is in one of its two pans: the lighter pan has coins that are potentially light and the heavier pan has coins that are potentially heavy.

Let’s add an additional assumption to the original problem. Suppose we have an unlimited supply of coins that we know to be real. Let u(n) be the maximum number of coins we can process in n weighings if we do not know their potential.

What would be the first weighing? Both scales might be balanced, meaning that the fake coin is in the leftover pile of coins with unknown potential. So we have to leave out not more than u(n−1) coins. On the other hand, exactly one scale might be unbalanced. In this case, all the coins on this scale will get their potential known. The number of these coins can’t be more than 5n-1. But this is an odd number, so we can use one extra real coin to make this number even, in order to put the same number of coins in each pan on this scale.

So u(n) = 2 · 5n-1 + u(n−1), and u(1) = 3. This gives the answer of (5n+1)/2. Now we need to go back and remember that we got this bound using an additional assumption that we have an unlimited supply of real coins. Looking closer, we do not need our additional supply of real coins to be unlimited; we just need not more than two real coins. The good news is that we will have these extra real coins after the first weighing. The bad news is that for the first weighing we do not have extra real coins at all. So in the first weighing we should put unknown coins against unknown coins, not more than 5n-1 on each scale, and as the number on each scale must be even, the best we can do is put 5n-1−1 coins on each scale.

Thus the answer is (5n−3)/2 for n more than 1.

We can generalize this problem to any number of scales used in parallel. Suppose the number of scales is k. Suppose the number of weighings is more than 1, then the following problems can be solved in n weighings:

  • If all the coins have known potential, then the maximum number of coins that can be resolved is (2k+1)n.
  • If we do not know the potential of any coin and there is an unlimited supply of real coins, the maximum number of coins that can be solved is defined by a recursion: u(n) = k (2k+1)n-1 + u(n−1) and u(1)=k + 1. So the answer is: ((2k+1)n+1)/2.
  • If we do not know the potential of any coin and there is no extra real coins, then the answer is u(n) − k = ((2k+1)n+1)/2 − k.

The methods I described can be used to answer another common question in the same setting: Find the fake coin and say whether it is heavier or lighter. Let us denote by U(n) the number of coins that can be resolved in n weighings when there is an unlimited supply of extra real coins. Then the recurrence for U(n) is the same as the recurrence for u(n): U(n) = 2·5n-1 + U(n−1). The only difference is in the initial conditions: U(1) = k. This means that U(n) = ((2k+1)n−1)/2. If we don’t have extra real coins then the answer is: U(n) = ((2k+1)n−1)/2 − k.

When we don’t need to say whether the fake coin is heavier or lighter, we can add one extra coin to the mix: the coin that doesn’t participate in any weighing and is fake if the scales always balance.

Share:Facebooktwitterredditpinterestlinkedinmail

Discussing a Problem from the Moscow Olympiad

I recently posted the following problem from the Moscow Olympiad:

There were n people at a meeting. It appears that any two people at the meeting shared exactly two common acquaintances.

  • Prove that all the people have exactly the same number of acquaintances at this meeting.
  • Show that n can be greater than 4.

Here is the proof for the first bullet. Choose a person X. Take a pair of X‘s acquaintances. These two acquaintances have to share two acquaintances between themselves one of whom is X. In other words, we have described a function from all pairs of X‘s acquaintances to people who are not X. On the other hand, for every person who is not X, s/he and X share a pair of acquaintances. Hence, there is a bijection between people other than X and all pairs of X‘s acquaintances. If the number of X‘s acquaintances is a, and the total number of people is t, then we have shown that (a choose 2) = t−1. As this is true for any X, we see that everyone has the same number of acquaintances. Moreover, this situation can happen only if t−1 is a triangular number.

But wait. There is more work that needs to be done. The smallest triangular number is 1. That means that t might be 2. If there are two people at the meeting, then the condition holds: they have 0 common acquaintances. The next triangular number is 3. So we need to see what would happen if there are four people. In this case, if everyone knows each other, it works. This is why the second bullet asks us to find an example of the situation with more than four people, because four people is too easy.

Let’s look at larger triangular numbers. The situation described in the problem might also happen when there are:

  • 7 people total and everyone has 4 acquaintances,
  • 11 people total and everyone has 5 acquaintances,
  • 16 people total and everyone has 6 acquaintances,
  • and so on: a(a−1)/2 + 1 people total and everyone has a acquaintances.

The official Olympiad solution suggests the following example for 16 people total. Suppose we put 16 people in a square formation so that everyone knows people in the same row and column. I leave it to the reader to check that every two people share exactly two acquaintances.

Let me prove that there is no solution for a total of seven people. If there were a solution, then each person would have to know four people. My first claim is that the acquaintance graph can’t contain a four-clique. Suppose there is a four-clique. Then each person in the clique has to have another acquaintance outside of the clique to make it up to four. In addition, this extra acquaintance can’t be shared with anyone in the clique, because the clique contains all the acquaintances that they share. This means we need to have at least four more people.

Next, suppose two people a and b know each other and share an acquaintance c. Any two people in this group of three has to have another shared acquaintance, who is not shared with the third person. That is, there should be another person who is the acquaintance of a and b, a different person who is an acquaintance of a and c, and a third person who is acquainted with b and c. These three extra people are all the acquaintances of a, b, and c. Which means the last person who is not acquainted with a, b, or c, has less than for four acquaintances.

Let’s look at a more difficult problem that I offered at the same posting:

There were n people at a meeting. It appears that any k people at the meeting shared exactly k common acquaintances.

  • Prove that all the people have exactly the same number of acquaintances at this meeting.
  • Is it possible that n can be greater than 2k?

As in the previous solution, we see that a, the number of acquaintances of a person and t, the total number of people, satisfy the following equation: (a choose k) = (t−1 choose k−1).

For example, if k = 3, the equation becomes (a choose 3) = (t−1 choose 2). This is a question of finding numbers that are both tetrahedral and triangular. They are known and their sequence, A027568, is finite: 0, 1, 10, 120, 1540, 7140. The corresponding number of acquaintances is 3, 5, 10, 22, 36 and the total number of people is 3, 6, 17, 57, 121. The first trivial example involves 3 people who do not know each other. The next example is also simple: it has 6 people and everyone knows everyone else.

What about non-trivial examples? If there are 17 people in the group, then each person has to know 10 people. Does the acquaintance graph exist so that every group of three people share 3 acquaintances?

We see that the problem consists of two different parts. First, we have to solve the equation that equates two binomial coefficients. And second, we need to build the acquaintance graph. Both questions are difficult. We see that for k = 2 we have an infinite number of solutions to the equation with binomial coefficients. For k = 3, that number is finite. What happens with other k? If there are 2k people and they all know each other, then this works. But are there other non-trivial solutions? I am grateful to Henry Cohn for directing me to the works of Singmaster who studied non-trivial repetitions of numbers in Pascal’s triangle. In particular, Singmaster showed that the equation (n+1 choose k+1) = (n choose k+2) has infinitely many solutions given by n = F2i+2F2i+3−1 and k = F2iF2i+2−1.

This sequence generates the following non-trivial examples (15 choose 5) = (14 choose 6), (104 choose 39) = (103 choose 40), and so on. That means it might be possible that there is a group of 16 people so that every 6 people share 6 acquaintances. In this situation every person must know everyone else except for one other person. That leads us to the structure of the acquaintance graph: it is a complement to the perfect matching graph. I leave it to my readers to check that the corresponding acquaintance graph doesn’t exist. Are there examples of two binomial coefficients that equal each other and that lead to an acquaintance graph that can be built?

Now that I’ve tackled the solution to this Olympiad problem, I see that I generated more questions than I answered.

Share:Facebooktwitterredditpinterestlinkedinmail

Missing Coin

I recently published the following coin puzzle:

There are four silver coins marked 1, 2, 3, and 5. They are supposed to weigh the number of grams that is written on them. One of the coins is fake and is lighter than it should be. Find the fake coin using the balance scale twice.

My readers, David Reynolds and ext_1973756, wrote to me that I am missing a coin of 4 grams. Indeed, the same puzzle with five coins—1, 2, 3, 4, and 5—is a more natural and a better puzzle.

David Reynolds also suggested to go all the way up to 9 coins:

There are nine silver coins marked 1, 2, 3, 4, 5, 6, 7, 8, and 9. They are supposed to weigh the number of grams that is written on them. One of the coins is fake and is lighter than it should be. Find the fake coin using the balance scale twice.

It is impossible to resolve this situation with more than nine coins as two weighings provide nine different answers to differentiate coins. But indeed it is possible to solve this problem for nine coins. It is even possible to suggest a non-adaptive algorithm, that is to describe the weighings before knowing the results.

To find such a strategy we need to satisfy two conditions. First, we have to weigh groups of coins of the same supposed weight, otherwise we do not get any useful information. Second, there shouldn’t be any two coins together (in or out of the pan) in both weighings, because it would then be impossible to differentiate between them.

Here is one possible solution of the problem:

  • The first weighing: 1, 5, and 9, against 2, 6, and 7
  • The second weighing: 1, 6, and 8, against 2, 4, and 9

David Reynolds also suggested a problem in which we do not know whether the fake coin is heavier or lighter:

There are four silver coins marked 1, 2, 3, and 4. They are supposed to weigh the number of grams that is written on them. One of the coins is fake and is either lighter or heavier than it should be. Find the fake coin using the balance scale twice.

Again, four coins is the best we can do when in addition to find it, we also want to determine if it is heavier or lighter. Indeed, if there were five coins we would have needed to cover ten different answers, which is too many for two weighings.

Here is the solution for four coins:

The two weighings are 1+3=4, and 1+2=3. If the first weighing balances, then the fake coin is 2 and the second weighing shows if it is heavier or lighter than it should be. Similarly, if the second weighing balances, then the fake coin is four and we can see whether it is heavier or lighter than it should be. If the left pan is lighter/heavier for both weighings, then the fake coin is 1 and is lighter/heavier. But if one pan is heavier on the first of two weighings and the other pan is heavier on the second weighing, then the fake coin is 3. In both cases it is easy to determine whether the fake coin is heavier or lighter.

Now David is missing a coin. If we just want to find the fake coin without determining whether it is heavier of lighter, we can do it with five coins:

There are five silver coins marked 1, 2, 3, 4, and 5. They are supposed to weigh the number of grams that is written on them. One of the coins is fake and is either lighter or heavier than it should be. Find the fake coin using the balance scale twice.

We can use the same solution as the previous (four coins) problem. If the scale balances both times, then the fake coin is 5. However, in this case we will not know whether the coin is heavier or lighter.

We can’t extend this problem to beyond five coins. Suppose we have six coins. We can’t use more than three coins in the first weighing. This is because if the scale unbalances, we can’t resolve more than three coins in one remaining weighing. Suppose the first weighing balances; then we have at least three leftover coins we know nothing about and one of them is fake. These three coins should be separated for the next weighing. That means one of the coins needs to be on the left pan and one on the right pan. We can add real coins any way we need. But if the second weighing unbalances we do not know if the fake coin is on the left and lighter or on the right and heavier.


Share:Facebooktwitterredditpinterestlinkedinmail