Slashdot Mirror


Your Favorite Math/Logic Riddles?

shma asks: "Whether you're involved in the Sciences, Mathematics, or Engineering, you undoubtedly enjoy finding simple solutions to seemingly difficult problems. I'm sure you all have a favorite mind-bender, and who better to share it with than the Slashdot community? Post your own problems and try to solve others. Just one request: If you have figured out the solution, link to it in a post, rather than write it out where anyone can see it." What brain benders tickle your fancy? "Here's a sample to consider: You're in a dark room with 50 quarters, 18 of which are heads up. You are allowed to move around the coins or flip some or all of them, if you wish. Problem is, it's too dark to tell what you're moving or flipping (no, you can't figure it out by touch either). Your job is to split the coins into two groups, each of which has the same number of heads up coins. How do you accomplish this?"

34 of 1,965 comments (clear)

  1. Look and Say by Noksagt · · Score: 5, Informative

    There's a good write up of this on MathWorld.

  2. Re:easy one by NitsujTPU · · Score: 4, Informative

    Uhmm, if n = 0, that is not true.

    a^0 = 1
    b^0 = 1
    c^0 = 1

    1 != 2

    So, I would submit that that might be true for all nonzero values of n.

  3. Re:Keeping my skills fresh by LeonGeeste · · Score: 1, Informative

    That's only the Theorem if you're expressing it in terms of quadrances (squares of distances), like that weirdo's book that got posted a short while ago on /. Ah, here it is:

    http://science.slashdot.org/article.pl?sid=05/09/1 7/1313249&tid=228&tid=14

    In normal trig, it's a^2 + b^2 = c^2.

    Thinking back, wouldn't it be cool to have a quadrance-ruler? It would be marked off in units of inches squared, and the reading on it would be the square of the number of inches in distance. (Of course, if you were a communist, that would be centimeters.)

    --
    Rank my idea: http://www.sinceslicedbread.com/node/531
  4. angle answer by mikeage · · Score: 2, Informative

    What is the degree of the angle between the hour hand and the minute hand when it is 2:15?
    22.5 degrees.

    Yes, you can do it iteratively until inifinity, but the minute hand is at 90 degrees off 12, and the hour hand is at 60 for 2, plus 30/4 for the :14, = 67.5. The difference is 22.5

    --
    -- Is "Sig" copyrighted by www.sig.com?
  5. Re:Phone Numbers by Anonymous Coward · · Score: 2, Informative

    H = first 3 digits
    T = last 4 digits

    [250*(80*H + 1) + 2*T - 250]/2
    [20000*H + 2*T]/2
    10000*H + T

  6. Re:easy one by calvin1981 · · Score: 5, Informative

    Well, If b=0, b^0 is not even defined ! For n=0, it is easy to see that there is no solution. For n smaller than 3, it is elementary to show that there are solutions (even infinitely many of them), and for n > 3, you have to be Andrew Wiles to show that :)

  7. Re:Solution by seminumerical · · Score: 2, Informative
    very nice!

    check it empirically by entering this as a google search:

    sqrt(2)^(sqrt(2)^(sqrt(2)^(sqrt(2)^(sqrt(2)^(sqrt( 2)^(sqrt(2)^(sqrt(2)^(sqrt(2)^sqrt(2)))))))))

    You don't actually need all the brackets:

    sqrt(2)^sqrt(2)^sqrt(2)^sqrt(2)^sqrt(2)^sqrt(2)^sq rt(2)^sqrt(2)^sqrt(2)^sqrt(2)^sqrt(2) will work just as well. It knows to evaluate from right to left.

    --
    In wartime... truth is so precious that she should always be attended by a bodyguard of lies. (Churchill)
  8. Re:easy one by iamdrscience · · Score: 1, Informative
    Well, If b=0, b^0 is not even defined
    Nope, 0^0 is one. Whip out a scientific calculator and check it.
  9. The best riddle site on the net by nyri · · Score: 3, Informative

    Is ..:: Riddles ::... In has (amogst others) the famous "prison with a lamp" problem:

    100 prisoners are imprisoned in solitary cells. Each cell is windowless and soundproof. There's a central living room with one light bulb; the bulb is initially off. No prisoner can see the light bulb from his or her own cell. Each day, the warden picks a prisoner equally at random, and that prisoner visits the central living room; at the end of the day the prisoner is returned to his cell. While in the living room, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting the claim that all 100 prisoners have been to the living room. If this assertion is false (that is, some prisoners still haven't been to the living room), all 100 prisoners will be shot for their stupidity. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world can always use more smart people. Thus, the assertion should only be made if the prisoner is 100% certain of its validity.

    Before this whole procedure begins, the prisoners are allowed to get together in the courtyard to discuss a plan. What is the optimal plan they can agree on, so that eventually, someone will make a correct assertion?

  10. whole bunch of em by mako1138 · · Score: 2, Informative

    Right here.

    Incidentally, that page has been slashdotted in the past.

  11. Re:Phone Numbers by SnowZero · · Score: 3, Informative

    a = first 3 digits
    b = last 4 digits

    ((a*80+1)*250 + b+b -250)/2
    (a*20000 + 250 + b*2 - 250)/2
    a*10000 + 125 + b - 125
    a*10000 + b

    It's only amazing if you don't know algebra, and no, a calculator is not required. Then again, if the point is to encourage people to eventually put down their calculator and instead try understanding why something works, then I'm all for it.

  12. Except... by nwbvt · · Score: 4, Informative

    Dividing by zero is not "perfectly valid algebra". Division is not closed on the set of real numbers. Its not really a riddle if you lie in the problem description. Otherwise the solution to the sample problem could be "Pull out 9 of the quarters into a seperate group. I was lying when I said you couldn't see any of them."

    --
    Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
  13. yes it's cute by croto · · Score: 2, Informative

    abcabc/13=(abc+1000*abc)/13=abc*1001/13=abc*77 nice!

  14. Re:Phone Numbers by arodland · · Score: 3, Informative

    Weak ;)

    (20000a + 250 + 2b - 250) / 2
    10000a + b

  15. Re:Link to online version by Anonymous Coward · · Score: 2, Informative

    Seven.

  16. Re:The King and the Chalice (only for Experts!) by admsteiner · · Score: 2, Informative

    This seems to be a derivation of a riddle given to my friend's math professor when he interviewed at the NSA...

    One person is appointed the leader. He always turns the cup upside down. Everyone else enters. If the cup is right side up, they leave it, if it upside down, they put it right side up, but only if they previously have not flipped the cup. So the only time the leader would flip the cup is if another prisoner had already been in the room.

    So how to deal with the fact that the King can flip the cup as well? Obviously its only an issue if the King flips the cup an odd number of times and then calls in the leader. Not sure how to get around this constraint, and the one that the King can hear them and thus foil the plan. But I'm off to bed, someone else can finish it.

  17. Re:The King and the Chalice (only for Experts!) by eff · · Score: 2, Informative
  18. Re:Math and science are obsolete by max+born · · Score: 2, Informative

    Bush doesn't initiate tax changes. They come from Congress and have to start in the House of Reps as set forth in Article I, section 7 of the US Constitution. You might wanna read Article II aswell, the limited powers of the presidency, U.S. Constitution.

    The way these values are determined is by equating a function like f(taxation) to total GNP or GDP and graphing the results then finding the highest point on a curve where GNP+f(taxation) is a max. Historically large taxes tend to reduce the GDP and small taxes are insuffient for the government to perform its duties as required by the constitution.

    The US currently collects about 3 trillion dollars in taxes every year.

    How they do it and what their reasoning is is all freely available online

    Maybe you can figure out where they're going wrong and run for office.

  19. Re:easy zero by tgv · · Score: 2, Informative

    Yes, it is undefined and you don't need a calculator. Actually, you shouldn't. But the bottom line is that it approaches 1, in the limit: lim(x->0) x^0 = 1, and for x^x this holds as well; you can try both on a calculator with very small values for x, if you want. In some "practical" problems, such as fitting a polynomial on a set of points, you really need 0^0 to be 1.

    However, if you're going to try the other limit, lim(x->0) 0^x, the answer would seem to be 0 (but since this function is not continuous, there is no need to make it equal 0).

    The theoretical answer? it depends on the function you're looking at.

    The pratical answer? Try 1.

  20. Re:Three Salesmen by Enti · · Score: 2, Informative

    I think the answer has to deal with the math being misleading. The value of $9 is provided to stump the reader, as it really doesn't pertain to the original cost of the room in the way suggested (9+9+9+2 != 30). Instead, 9+9+9 resembles what the men end up paying for the room (27), but the total is expected to be 25. The real question then becomes, "Who pocketed the extra two dollars?" (9+9+9-2 = 25). In the end, it seems to be just a matter of the logic problem playing off of misplaced signs (+/-).

    --
    In these days, bleeps and bloops mean something more
  21. Re:The King and the Chalice: full solution by Anonymous Coward · · Score: 1, Informative

    let me first reword the problem to the way I think of it. Let us think of all the prisoner having "tokens" that they are passing around via the cup. Flipping the cup up means you leave one of your tokens in the center room. Flipping it down means you take the token. Obviously only one token can be left in the center room at a time.

    Now the problem just becomes one of having the leader collect enough tokens. The cup can start up or down, so there may be an extra token in play. Allowing the king to flip the cup out of sight of the prisoners allows him to add or remove a token from the system with each flip. Thus if the prisoners start with a total of x tokens among all of them, over the course of the game that total may change to between x - k and x + k + 1 (+ 1 there because the cup might start sitting upright).

    Now, the solution is that all prisoners except the leader start with 2k + 2 tokens (so the prisoners start with a total of (n - 1)(2k + 2) tokens. The leader will say yes once he has collected (n - 1)(2k + 2) - k tokens. We need to show that the leader can always collect this many tokens, and that he cannot get this many tokens unless ever prisoner has left at least one token in the center room.

    We can see that the leader can always collect this many tokens because the king can take at most k tokens out of play leaving only (n - 1)(2k + 2) - k tokens. Since all players will be called an arbitrary number of times, they will all get a chance to leave all their tokens in the center room and the leader will get a chance to pick them all up (the ones that the king doesn't take).

    Now consider the case where one prisoner is not called out for a very long time and all other tokens are allowed to be transferred to the leader first. In addition we will assume that the cup starts up and that the king adds k tokens to the system. In this case, there are (n - 2)(2k + 2) + k + 1 = (n - 1)(2k + 2) - 2k - 2 + k + 1 = (n - 1)(2k + 2) - k - 1 tokens in play. This is one less that the required number of tokens for the leader to say yes, so he can't possibly say yes until that last prisoner comes out and gets to transfer one of his tokens to the leader.

    That is a bit hand wavy, but I think it is a good proof. I have no idea if this is the best possible solution, though. I have good reason to believe that it is not the fastest (if the king chooses who to bring out arbitrarily). Check out http://www.ocf.berkeley.edu/~wwu/riddles/hard.shtm l#100prisonersLightBulb if you are interested in this type of problem and want to figure out the "fastest" solution. That whole forum is full of really hard math puzzles.

    -- corygwilliams AT google's mail place

  22. Re:Riddle by Spazmogazm · · Score: 2, Informative

    In the first case where you don't know if the boy is the first child or not there are four possibilites BB, BG, GB and GG. We can eliminate GG since that's now impossible. From the remaining 3 cases only BB would allow the second child to be a boy so the chance
    that the other child is a girl is 2/3.

    In the second case where we know the child is the oldest boy there are only 2 possibilites BB and BG. We can't eliminate any possibilites so the chance the second child is a girl is 1/2.

  23. Re:The King and the Chalice (only for Experts!) by G-funk · · Score: 3, Informative

    It's a terribly written version of the "warden and his prisoners" problem, which you can google. The only difference other than confusing language is the original problem has two on/off switches, and each prisoner must flip one, rather than one that can be left alone.

    *Spoiler* Don't read the following if you don't wanna know the answer:

    1) The prisoners elect one of their own to be a counter, the rest we will call non-counters.

    2) When a non-counter comes into the chalice room, if he can he will put the chalice right side up. If it's already right side up, he'll leave it alone. However, each non-counter will only do this once. If he's already flipped it in the past, and it's upside down, he'll leave it upside down.

    3) Every time the counter comes in, he checks the chalice. If it's upside down, he'll do nothing. If it's right side up, he'll flip it, and add one to his count. Once he's flipped it n times (n being the prisoner count), he knows everyone has done it. If the original state of the chalice is known, the problem can be modified so he only needs to flip it n-1 times.

    --
    Send lawyers, guns, and money!
  24. Re:The King and the Chalice (only for Experts!) by oldCoder · · Score: 2, Informative

    The king can only flip the cup K times. The Counter is waiting for (N - 1) * (K + 1) flips, which is bigger than K.

    --

    I18N == Intergalacticization
  25. Re:easy one by Mornelithe · · Score: 2, Informative

    That's not generally agreed upon.

    http://www.faqs.org/faqs/sci-math-faq/specialnumbe rs/0to0/

    There were/are mathematicians who argue that 0^0 is 1, and those that argue that it's undefined.

    --

    I've come for the woman, and your head.

  26. Re:Three Salesmen by Metasquares · · Score: 2, Informative

    They each pay $10 when the room is $30. The room's price drops to $25, so they're each given $1 back, bringing their total to $27. The bellhop keeps the other $2 that would have brought their total down to $25. The $5 is still there, as $1 each for 3 people + $2 for the bellhop = $5. The total amount does not need to equal $30 after the price changes; it needs to equal $25.

  27. Re:Phone Numbers by swillden · · Score: 2, Informative

    These sorts of tricks are magical only to those who never took 7th-grade algebra (or won't apply it):

    Let a be the three-digit prefix and b be the four digit number.

    (((80a+1)250+2b)-250)/2

    (20000a + 250 + 2b - 250)/2

    (20000a + 2b)/2

    10000a + b

    Which is obviously your phone number. No, I didn't try it.

    More interesting tricks (not puzzles) of this sort rely on less-obvious (unless you know them) arithmetic facts, like relationships between numbers and the sum of their digits.

    --
    Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  28. one of my favorites by Cow+Jones · · Score: 2, Informative

    1
    1 1
    2 1
    1 2 1 1
    1 1 1 2 2 1
    3 1 2 2 1 1
    1 3 1 1 2 2 2 1
    1 1 1 3 2 1 3 2 1 1
    3 1 1 3 1 2 1 1 1 3 1 2 2 1

    continue the series!

    --

    Ah, arrogance and stupidity, all in the same package. How efficient of you. -- Londo Mollari
  29. Coloured stamps by slavemowgli · · Score: 2, Informative

    Here's another nice one, courtesy of Raymond Smullyan.

    Suppose there are three people, called A, B and C. Each of these is a "perfect logician"; that is, given some information, they all are able to immediately draw any and all conclusions that can possibly be drawn from this information. Furthermore, suppose there are four red and four green stamps.

    Now, all three of them close their eyes, and two stamps are glued to their foreheads, each; the remaining two stamps are put away. Now, they all open their eyes again.

    Then, the first, A, is asked whether he knows the colours of the stamps on his forehead. He says he doesn't. Then B is asked the same thing, and also says he doesn't, and afterwards, C is asked and says he doesn't, too. Now, A is asked a second time, and he still says he doesn't know. But then, when B is asked a second time, he now says he does know.

    The question is: how?

    --
    quidquid latine dictum sit altum videtur.
  30. Re:the problem of the twelve billiard balls by Anonymous Coward · · Score: 1, Informative
  31. Re:Light Bulb by Thu+Anon+Coward · · Score: 2, Informative

    man, you solved it the hard way. it says a windowless room. therefore, all I have to do is get down on the floor after flipping each switch. if I see light coming out from under the door, ergo, I have my solution. there is no other light source, doors are required to have those gaps underneath in order to allow for building ventilation, and whatever M$ doesn't tell me about the conditions of the room, I can modify to my advantage.

    an even easier solution would be to get a fireaxe, chop a hole in the door, and flip switches while I looked thru the hole. haven't opened the door and I've solved it in even less time than your method.

    when dealing with idiotic interview questions like this, use the unexpected solution.

    --



    I'm good with numbers - .45, 7.62, 9.....
  32. Re:The King and the Chalice (only for Experts!) by notshannon · · Score: 2, Informative

    * spoiler *

    Accounting for the k flips the king gets to make:

    The value k is known to all the prisoners.

    One prisoner is the counter, the rest noncounters.
    The counter's count starts at 0.

    If a noncounter sees the up side down chalice, and
    that noncounter has not righted the chalice 2k+1 times
    already, then that noncounter will right the chalice.

    If the counter sees the right side up chalice, the
    counter will turn it up side down, and increment the
    count.

    The king, with his k royal flips, can augment the
    count by up to k, or cancel up to k indications for
    the counter to count.

    If one noncounter has never been in the room, the maximum
    value of the count is (n-2)(2k+1) + k = 2nk + n - 3k - 2.

    If every counter has been in the room k+1 times,
    which happens inevitably according to the problem,
    the minimum value of the count is (n-1)(2k+1) - k = 2nk + n - 3k - 1.

    The counter asserts yes when the count reaches 2nk + n - 3k - 1.

    If we further assume that the king refills the chalice
    with an intoxicating liquor whenever it is right side up...

  33. MOD PARENT TROLL by LeonGeeste · · Score: 4, Informative

    I had a conversation with Brian0918 on AIM this morning, in which he revealed he's really trolling when I pointed out to him there is no solution (see my other posts) on this topic. Here's a little tidbit: ". i usually just post the problem to get people into big disputes, which so far has worked 2 out of 2 times". If you want the full conversation, email me at sbartaNOSPAM_at_MAPSONgmail.com.

    --
    Rank my idea: http://www.sinceslicedbread.com/node/531
  34. Re:My all-time favorite logic puzzle by Geoff-with-a-G · · Score: 2, Informative

    One small correction:
    "The Guru speaks only once (let's say at noon), on one day in all their endless years on the island."
    should read:
    "The Guru speaks only once (let's say at noon), on each day of all their endless years on the island."

    "only once... on one day" says that after the first day the Guru never speaks again.