• subscribe
March 22, 2007 12:00 AM

The Logical Puzzle

SQL Server Pro
InstantDoc ID #95201

Solution to March's Puzzle: Free Tuna
You go to the grocery store and grab eight cans of tuna from the shelf. You go to the cash register to pay. In a good mood, the store owner hands you three plastic bags and says, "If you can arrange the eight cans in these three plastic bags such that each bag contains an odd number of cans, you can have them for free." Can you think of a way to get that free tuna?

Obviously, you can't divide the eight tuna cans into three separate plastic bags so that each holds an odd number of cans. However, nothing in the puzzle dictates the arrangement of the bags around the tuna cans. The sum of three odd numbers x+y+z, where each number is considered only once, naturally amounts to an odd number. However, taking one of the odd numbers into consideration twice allows for an arrangement in which one of the elements is even (say, y)—for example, (y+(x))+(z) = 8. The use of parentheses is intentional—each pair of parentheses represents a plastic bag. For example, let x equal 1, y equal 2, and z equal 5: You place 1 tuna can in plastic bag A, 2 tuna cans in plastic bag B, and 5 tuna cans in plastic bag C. Then, place plastic bag A in plastic bag B. You end up with 1 tuna can in bag A, 3 in B (x+y), and 5 in C.

As an aside, if you like trying to solve open puzzles, the tuna cans puzzle reminds me of a mathematical conjecture that so far hasn't been proven. The conjecture is named after its conjurer—"Goldbach's conjecture." The original conjecture says, Every odd number can be expressed as the sum of three prime numbers. Euler simplified the conjecture to the form Every even number can be expressed as the sum of two prime numbers. In case you're wondering, I'm not planning on publishing the proof to this conjecture next month.

April's Puzzle: Naming an Heir
A mighty king had three sons and wanted to declare the wisest of them as his heir. He decided to give them a logic puzzle to test their wisdom. He placed the sons in a triangular room, each in a different corner, and placed a hat on each son's head. The king said, "You need to determine the color of your hat. You can't take your hat off to look at it, and you can't communicate in any way. The hat on your head is either green or red. At least one of you is wearing a green hat. I'll be waiting outside the door and will ring a bell every 5 minutes. You can't leave the room until you know the color of your hat. If you know the answer, you must wait for the next bell ring, then come tell me the answer." At the third bell ring, one of the sons opened the door and told the king the answer. The king said, "You're correct, and I'm naming you my heir. However, I'm disappointed in you. You still have much to learn." What was that son's answer, and why was the king disappointed?



ARTICLE TOOLS

Comments
  • BIJIMON
    4 years ago
    Dec 30, 2008

    You could also do 1 + (7+0). i.e. Put all 7 cans in one bag, put that bag inside another. And put the 1 remaining can in the third bag.

  • Michael
    5 years ago
    Apr 20, 2007

    Green. I solved it by determining "most red hats":

    Starting out, there were at most two red-hatted sons. In that case, the one who saw red hats on both his brothers heads would have left on the first bell. That didn't happen, indicating there was at most one red-hatted son. Assuming one did have on a red hat, the two in position to observe it would have left on the second bell. That didn't happen either, indicating that no one was wearing a red hat. The first son to deduce that all had on green hats became heir.

    The king was dissappointed because of the three possible starting conditions (two red hats, one red hat, no red hats) only one (no red hats) could serve as a non-biased test of wisdom, a fact that a truly wise heir would have deduced at the beginning.

  • Jeremy
    5 years ago
    Apr 19, 2007

    Green. Only with all three of them wearing a green hat would it be impossible for any one of them to definitively know the exact color of their own hat. After the first bell, it should have been clear to all of the sons that none of their brothers were able to figure out with absolute certainty the color of their own hat. Thus, the sons should have been able to conclude that all of the other sons were stuck, leading to the conclusion that none of them had a red hat. By the time the second bell rang, any one of the sons should have been able to tell the king that they had a green hat, because if anyone did have a red hat, one of the other brothers would have been able to figure their own hat color already. The king was disappointed because the son waited through the second bell until the third bell. He should have had more confidence in his deduction and went ahead and told the king his answer on the second bell. He was too cautious.

  • Clifton
    5 years ago
    Apr 11, 2007

    Green. Both of the other sons had red hats and since one was wearing a green hat, the only colour left was green.

    The king was disappointed because it took the son 15 minutes to notice.

You must log on before posting a comment.

Are you a new visitor? Register Here
  • SP1?
    I know there is a SP1 for SQL 2008 R2 available....and there is a "feature pack" as well... ...
  • SQL database mirroring
    I have SQL Server 2008 R2 Enterprise 64bit on Windows 2008 R2 Enterprise 64bit.  Each SQL Server has...
  • Dell Compellent Disk Drive
    Does anybody has experience with Dell Compellent Disk Drive? Basically, this system manages all disk...
  • Sql server performance tuning
    I need to find a tool that help me to optimize sql server,queries,improve the performance and solve ...