A little logic puzzle


As a respite from political news, here is a nice little logic puzzle.

Alice and Bob are two infinitely intelligent logicians. Each has a number drawn on their forehead. Each can see the other’s number but not their own. Each knows that both numbers are positive integers. An observer tells them that the number 50 is either the sum or the product of the two numbers. Alice says to Bob, “I do not know my number,” and Bob replies, “I do not know my number either.” What is Alice’s number?

The above link also points you to the solution.

Comments

  1. says

    My key to the solution starts with the fact that the only way that Alice doesn’t know her number is if Bob’s number (which she can see on his forehead) doesn’t allow a single answer. E.g. if Bob’s number was 6, Alice would instantly know that her number must be 44, since that’s the only way to reach 50, by the available rules; by sum or product.

    So, Bob’s number must allow more than one answer, meaning that it must allow legal answers by both rules. E.g. if Bob’s number is 5, then Alice’s number could be either 10 or 45; she doesn’t know which. We can identify the possible numbers by checking the prime factors of 50. Since both numbers have to be integers, these will be the only numbers possible for following the product rule as well as the sum rule. Since 50 has only the prime factors 2, 5, 5, this leaves only 1, 2, 5, 10, and 25 as numbers possible for Bob (the “positive integers” rule disallows 50).

    However, we’re also told that even after receiving this information, Bob still doesn’t know his own number. He sees Alice’s number and he knows that Alice can’t deduce her number from seeing his. The same logic applies in reverse; the only way this is possible is if Alice’s number yields two possible answers, even though we’ve already limited the options to the five numbers mentioned above.
    E.g. Alice looks at Bob’s forehead and sees a 5. She doesn’t know if she has a 10 or a 40. But once Bob sees that she has a 10, he knows that 10 and 40 are the only options for his number AND he knows that if his number was 40, Alice would have easily figured it out. The fact that she doesn’t know means that his number must be 10 and Alice’s therefore is 40.

    The only possibility that works is for Alice to have the number 25. Bob will have either 2 or 25, both of which have two options, leaving Alice in doubt. Meanwhile, Bob will see a 25, so even with the additional information that Alice couldn’t deduce her own number, he still can’t make a deduction of his own.

    I think that’s right, but for the sake of honesty, I’ll post before checking.

  2. file thirteen says

    I came up with a related puzzle.

    Alice and Bob are two logicians. Each has a positive integer drawn on their forehead. Each can see the other’s number but not their own. An observer tells them that the number 50 is either the sum or the product of the two numbers. Alice says to Bob, “I don’t what my number is, and if you tell me that you know yours, I still won’t know what mine is.” What is Bob’s number?

  3. Rob Grigjanis says

    file thirteen: Not sure you’ve thought this through. If Alice doesn’t know her number, that means she saw Bob’s number as 1, 2. 5, 10 or 25 (the numbers which each have two possible alternates for Alice’s number). Bob knowing his own number doesn’t change that. The clincher in the original problem is Bob responding that he still doesn’t know his number, which fixes Alice’s number at 25, the only number which occurs twice in Alice’s possibilities.

  4. Peter B says

    The Problem is Wrong
    If Bob sees anything except 0, 1, 2, 5, 10, 25, or 50 he will know he has 50-A so all others are out.
    But if…
    A=0 then B must = 50 so Bob knows
    A=1 then B= 50 (can’t be 49 or Alice would know her number)
    A=2 then B = 25 (can’t be 48 or Alice would know her number)
    A=5 then B = 10 (can’t be 45 or Alice would know her number)
    A=10 then B=5 (can’t be 40 or Alice would know her number)
    A=25 then B=2 (25 would also work here)
    A=50 then must B=0 or Bob Alice would know her number
    But we have a problem. We can reverse A&B in the above.
    Both Bob and Alice must have 25.
    And they both know it. The Problem is Wrong.

  5. file thirteen says

    @Rob #6

    Bob knowing his own number doesn’t change that.

    If Bob knows his own number, it’s because he could deduce it. Which means… ?

  6. file thirteen says

    @Peter #7

    The order of knowing is significant. Alice not knowing means Bob has 1, 2, 5, 10 or 25 (not 50 -- Alice would have to have 1 in that case). Bob not knowing means Alice has the same restriction, but if Alice had 1, 2, 5 or 10, Bob would know his number (it would have to be the multiplicative complement because Alice would know her number if it was the additive complement; eg. if Bob had 45, Alice would know her number immediately). Therefore Alice knows she has 25. Bob could still have 2 or 25 though. Bob knows it’s one of those two, but he can’t tell which merely from Alice’s deduction.

  7. file thirteen says

    For clarity, I should have said Alice would “have known” her number rather than “know”

  8. Peter B says

    file thirteen @9,
    The problem is symmetrical. Reverse Bob and Alice. The order of knowing is not significant; it works both ways. Once both say they don’t know they both know the game is rigged.

  9. file thirteen says

    @Peter #12

    You’re hung up on the idea of it being reversible, but that’s not the case. Bob telling Alice he doesn’t know his number consequent to Alice telling Bob she doesn’t know hers is not the same exchange of information. Suppose you’re Bob. How you can know that you don’t have the number 2 even after Alice knows she must have 25?

  10. Bekenstein Bound says

    @file thirteen: 1. Bob could be seeing either 49 or 50, and in both cases would be able to infer his own number.

    And once again I was beset by that bogus “missing name or email” error message when I tried to post this comment. It said “Leave a Reply. Logged in as Bekenstein Bound. Log out? Comment” and the input box, then an unchecked “Notify me of followup comments…” and the post and preview buttons. No name or email fields to fill in. Sending generated the error message saying I forgot to fill in these nonexistent fields. Shift-F5 logged me out instead of “only” reloading a fresh copy of the page — I’m pretty sure shift-F5 shouldn’t log you out, right? And after I logged back in, either it finally worked or you’re hallucinating this comment and not really actually reading it.

    What is causing these persistent glitches, and so many issues with YT embeds, on this blog?!

  11. Rob Grigjanis says

    PeterB: First off, both numbers are positive integers, so 0 is right out. Alice and Bob both know the other’s number, and that either the product or the sum of their numbers is 50. Call Alice’s number A, and Bob’s B. Either AB=50, or A+B=50.

    If B is anything other than 1,2 ,5,10 or 25, then A must be 50-B. But if it is one of 1,2,5,10 or 25, there are two possible values for A. Since Alice says she doesn’t know her number, B must be one of 1,2,5,10 or 25. This is where the symmetry is broken. Now Bob knows that his own number is one of those.

    If B is in (1,2,5,10,25), there is a set of numbers which could be Alice’s. If B=1, A could be 49 or 50. If B=2, A could be 25 or 48. And so on. Among all these numbers, the only one that occurs more than once is 25. Bob saying he doesn’t know his own number at this point means precisely that he sees Alice’s number as being 25, which means his own number is either 2 or 25. Only Alice knows which is correct.

  12. file thirteen says

    @BB #15

    Correct! 🙂

    The full story is as follows (I’m using the “spoiler” tag, don’t know if that’s supported here. If not, sorry for giving it away if you’re still working on it).

    Firstly, Alice does not know her own number. Therefore Bob’s must be 1, 2, 5, 10 or 25 (same logic as in the original puzzle). But this time, Bob is able to deduce his own number. How did Bob do that? If Alice’s number was other than 1, 2, 5, 10 or 25, Bob would be able to determine what his number was simply by subtracting Alice’s number from 50. But in such a case, Alice would have known her own number, as there would be only one possibility of a match with Bob’s to make 50. So Alice’s number is also one of 1, 2, 5, 10 or 25. Now if Alice’s number was 2, 5 or 10, Bob would not be able to deduce his number, but he did. And if Alice’s number was 25, Alice would have been able to deduce that once Bob had told her that he wasn’t able to deduce it (which was the original problem). So Bob’s number is 1, and Alice’s is either 49 (additive) or 50.(multiplicative)

  13. Rob Grigjanis says

    file thirteen: I have no idea what the statement of your problem is. You say Bob and Alice can see each other’s numbers, but not their own. Then Alice says something, and Bob can somehow magically deduce his own number? How does that work?

  14. file thirteen says

    Actually I could have simplified the bit in the middle of my explanation.

    Now if Alice’s number was 2, 5 or 10, 2, 5, 10 or 25, Bob would not be able to deduce his number, but he did. And if Alice’s number was 25, Alice would have been able to deduce that once Bob had told her that he wasn’t able to deduce it (which was the original problem).

  15. file thirteen says

    @Rob #18

    Maybe I should have put Bob in a soundproof booth or given him earplugs or something so you wouldn’t be confused by thinking that anything Alice said had anything to do with Bob working out his own number. As said at the start, “An observer tells them that the number 50 is either the sum or the product of the two numbers.” If you were Bob, and Alice had 29, you could work out what your own number is straight away, right?

  16. Rob Grigjanis says

    So, Alice’s number must be one of 1,2,5,10,25. And Alice’s number must be 49 or 50. Neat trick (unless I’m missing something)!

  17. file thirteen says

    @Rob #21

    Oops, that was indeed a neat trick. The problem was right, but my explanation was utter rubbish! Let me try again.

    Firstly, Alice does not know her own number. Therefore Bob’s must be 1, 2, 5, 10 or 25 (same logic as in the original puzzle). But this time, Bob is able to deduce his own number, meaning that there is only one possibility for the total to end up as 50. Alice’s number must be other than 1, 2, 5, 10 or 25 for Bob to do that. And of all the other numbers that Alice could have, only the number 1 has more than one possibility for Alice (49 or 50) for Alice not to be able to work out her number. Therefore Bob’s number is 1.

  18. chigau (違う) says

    In Base 10, if the digits of a NUMBER sum to a number that is divisible by 3, NUMBER is divisible by 3.

  19. Snowberry says

    I notice that there are a couple of assumptions baked into the puzzle.

    The observer is not specifically noted as being an “infinitely intelligent logician” like Alice and Bob. They could be some rando who happened to pass by for all we know. Some people treat 0 as a positive number (because it’s not negative), despite technically being neither positive nor negative. The word “or” is ambiguous in casual language; it can mean “only one of these things” (exclusive OR) or “at least one of these things” (inclusive OR). We sometimes use “and/or” to clarify the latter, but just “or” by itself is ambiguous. Little things like this can occasionally matter, either because the puzzle-maker didn’t consider all the ways their wording might be misinterpreted, or because most people couldn’t be expected to know or assume the strict technical definition(s) they’re using, or because you’re running a real-life version of a puzzle where one of the participants is some outsider who isn’t solving it and is instead providing hints based on what they observe. (Of course, in the latter case the outsider can wreck the puzzle in other ways, including by lying.)

    In this particular case, it ends up not mattering much. Zero can be eliminated as invalid in either version. In the original, it doesn’t matter whether you’re assuming exclusive or inclusive, but it file thirteen’s variation, it’s not solvable if you assume that the observer meant “either sum or product, but not both” (exclusive OR). On one level this is not a problem (just switch to inclusive, consciously or subconsciously) but on another level it kind of is (if someone gets stuck on that point not realizing that they’re stuck). Then again, I suspect “and/or” in this case would give away the game for some people if they only saw file thirteen’s version. In other puzzles that sort of subtle ambiguity could even result in an answer the puzzle-maker didn’t intend.

    This isn’t intended as any sort of criticism. It’s just an observation.

  20. file thirteen says

    @Snowberry #25

    Posing a problem in a readable way but without obvious flaws can be more of a problem than the problem itself. The words “infinitely intelligent” in the original puzzle irked me as pretentious, so I decided to leave them out of my variant (which itself could have done with going through several levels of editing before being shared with everyone; notably my puzzle’s wording confused Rob whereas the original’s didn’t). What is “infinitely intelligent” anyway?

    Alice and Bob are infinitely intelligent. The observer enters the room with a marker, ready to draw numbers on their foreheads, but falls directly through a trapdoor into a pit of flesh-eating piranhas. Alice and Bob both knew this would happen. Neither of them can be bothered with trivial logic problems.

  21. Holms says

    Twenty five, because it is the only option where: both people looking at each other do not have a single possibility for themselves even after the commentary. (The actual reasoning took a tad longer than that…)
    Agreed, it was a nice one.

    And now that that is written, I see the reasoning has already been explained in full, so I’m glad I didn’t type it in full.

    #12
    The problem is symmetrical up until one of them gives the other an item of information. At that point, the person that has not yet spoken has more information than before. That person is no longer making the same calculation.

  22. John Morales says

    I took an interest in Diophantine equations, back when I was a lad.

    “Alice says to Bob, “I do not know my number,” and Bob replies, “I do not know my number either.””

    This, after they had been informed either the sum or the product would yield 50.
    And the solution is so simple.

    “Alice and Bob are two infinitely intelligent logicians.”

    (It’s never Adam and Beth, is it?)

    If they’re actually infinitely intelligent logicians but still don’t know their number given the information, then the proposed answer must be incorrect, and the product of less than infinite logic.

    It follows that they are not actually infinitely intelligent logicians, from which follows that the proposed puzzle has at least one lie in it.

  23. Rob Grigjanis says

    WTF are you talking about, John? Infinite intelligence (a silly addition to the problem statement, but still…) does not mean omniscience.

    After being told of the product/sum restriction, Alice saying she does not know her own number simply means that she sees Bob’s number as one of 1,2,5,10,25; the numbers which each have two possible answers for Alice’s number.

    When Bob hears Alice’s statement, he then knows (cuz he’s intelligent) that his own number is one of those. Alice’s statement limits the possible values of her number (which Bob can see) to 2,5,10,25,40,45,48,49 and 50. The only one of those values which maps to more than one possible value for Bob is 25, so that must be the value Bob sees on Alice, if he says he still doesn’t know his own number.

    So when Bob says he doesn’t know his own number, Alice can deduce that hers is 25. But at the end of play, Bob still doesn’t know whether his own is 2 or 25, and his infinite intelligence is no help to him.

  24. John Morales says

    Well, KG.

    Infinite intelligence (a silly addition to the problem statement, but still…) does not mean omniscience.

    It means more intelligent than you or I or the puzzle maker or the puzzle solver.
    Unless you hold at least one of those is infinitely intelligent, of course.

    Of course, if it’s a silly addition, it means that the person making the puzzle did a silly thing.
    Or else it’s intentional and not actually redundant, but part of the puzzle.

    It’s part of the puzzle.

    Your further elaborations are futile, in that light.

    (Unless you fancy you are infinitely intelligent, of course)

  25. John Morales says

    Oh, right.

    Finite intelligence, I. 🙂

    (Should I step down in favour of a younger truth machine? Not yet, I reckon)

    But yeah.

    Sorry.

  26. Mano Singham says

    The use of the description ‘infinitely intelligent’ was unfortunate but I took it to mean that Alice and Bob would be aware of, and not overlook, any logical argument that could be used to solve the problem.

  27. Rob Grigjanis says

    John @34: Same problem.

    The generic case could be posed as:

    A knows one number, B knows another number. They are told that it so happens that either the product or the sum of those numbers is N. The only restrictions on N are that it has at least two non-trivial integer divisors (the trivial ones being 1,N), and N is even.

    If A says they don’t know the other number, and B then says the same, then A can conclude that the other number is N/2.

  28. John Morales says

    I know, Rob. I was just amused it popped into my feed.

    To be fair, I have watched that channel before, but it still seems odd.

    (No infinite intelligence there)

  29. Bekenstein Bound says

    I wonder if any similar puzzle can be made to work with polynomials, Gaussian integers, or other things that have a version of unique factorization?

Leave a Reply

Your email address will not be published. Required fields are marked *