My Number

Here is my new logic puzzle.

I thought of a positive integer that is below 100 and is divisible by 7. In addition to the public knowledge above, I privately tell the units digit of my number to Alice and the tens digit to Bob. Alice and Bob are very logical people, but their conversation might seem strange:

Alice: You do not know Tanya’s number.
Bob: I know Tanya’s number.

What is my number?

Share:facebooktwittergoogle_plusredditpinterestlinkedinmail

8 Comments

  1. ghoti:

    It may be 77, isn’t it?

  2. #thatlogicproblem round-up | The Aperiodical:

    […] Tanya Khovanova is the master of this sort of thing. Conway’s wizards on a bus puzzle is the apotheosis of the genre and Tanya has written a great paper about its solution, along with a generalised version. Probably inspired by the current hullabaloo (or maybe not – she is usually thinking about these things), Tanya posted an extremely concise puzzle to her blog yesterday. […]

  3. Ronald:

    According to me, it’s 70. But I got Cheryl’s Birthday wrong :)

  4. P.-S. Park:

    Nice little puzzle. My answer is 70.
    I translated your post into Korean and uploaded it on my blog, FB, Twitter.
    It’s popular!

  5. Hwasop Lim:

    The answer is 70.

    This is a little bit tedious but I wrote everything out so that anyone can understand it. OK. maybe not anyone, but as many people as possible.

    TN = Tanya’s number

    (1) The integers satisfying the publicly available information are 07, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91 and 98.
    (2-X0) Suppose Alice was given ‘X0′. She will think “This must be 70. However, since Bob will see it only as ‘7X’, there’s no way for Bob to tell whether it’s 70 or 77. Therefore, I can say with confidence that at this stage Bob doesn’t know TN.
    (2-X1) Suppose Alice was given ‘X1′. She will think “TN must be 21 or 91. If it’s 21, then Bob must have been given ‘2X’, from which he cannot tell whether it’s 21 or 28. If it’s 91, then Bob must have been given ‘9X’, from which he cannot tell whether it’s 91 or 98. Therefore I can confidently say Bob at this stage doesn’t know TN.”
    (2-X2) Suppose Alice was given ‘X2′. She will think “This must be 42. Bob must have been given ‘4X’ and he won’t be able to say if it’s 42 or 49. There is no way Bob knows TN.”
    (2-X3) Suppose Alice was given ‘X3′. She will think “This must be 63. Bob must have been given ‘6X’ and he must have easily deduced that it must be 63.” So Alice wouldn’t have said anything like her part in the conversation. We can rule out this possibility.
    (2-X4) Suppose Alice was given ‘X4′. She will think “This must be either 14 or 84. Either case, Bob knows TN. If given ‘1X’, he will know it’s 14 and if given ‘8X’, he will realize it’s 84.” So we see that there’s no way for Alice to say anything like her part in the conversation. We can rule out this possibility.
    (2-X5) Suppose Alice was given ‘X5′. She will think “This mus be 35. Then Bob must have been given ‘3X’ and easily concluded it’s 35.” So we see that there’s no way for Alice to say anything like her part in the conversation. We can rule out this possibility.
    (2-X6) Suppose Alice was given ‘X6′. She will think “This must be 56. Bob must have been given ‘5X’ and easily concluded that it’s 56.” So we see that there’s no way for Alice to say anything like her part in the conversation. We can rule out this possibility.
    (2-X7) Suppose Alice was given ‘X7′. She will think “This is either 07 or 77. If it is 07, then Bob will see it as ‘0X’ and Bob must know it’s 07. However, if it is 77, the Bob will see it as ‘7X’ and won’t know whether it’s 70 or 77. I can’t confidently assume Bob’s ignorance of TN.” So we see that there’s no way for Alice to say anything like her part in the conversation. We can rule out this possibility.
    (2-X8) Suppose Alice was given ‘X8′. She will think “This is either 28 or 98. If it’s 28, then Bob won’t know if it’s 21 or 28 because he will see it as ‘2X’. If it’s 98, then Bob won’t know if it’s 91 or 98 because he will see it as ‘9X’. Either way, Bob doesn’t know.”
    (2-X9) Suppose Alice was given ‘X9′. She will think “This must be 49. But Bob sees it as just ‘4X’ and there’s no way for him to say it’s 42 or 49. Bob doesn’t know.”
    (2-Lemma) From (2-X0) through (2-X9), we see that 21, 28, 42, 49, 70, 91, 98 are the only remaining possibilities logically allowed by Alice’s remark.
    (3) Bob said he knows TN, which basically means that he was able to determine TN from (2-Lemma) and the tens-digit information. Therefore, it is obvious that he hasn’t been given ‘2X’ or ‘4X’ or ‘9X’. This leaves us with just ‘7X’, i.e. 70 in this case.

    Let’s reconstruct the situation now.
    Alice is given ‘X0′ and Bob is given ‘7X’. The candidates are 07, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91 and 98.
    Given ‘X0′, Alice thinks “This must be 70, because it’s the only one in the candidate pool that ends with a 0. But Bob will see it only as ‘7X’, there’s no way for Bob to tell whether it’s 70 or 77. Therefore, I can say with confidence that at this stage Bob doesn’t know what TN is.”
    Then Alice tells Bob “You do not know Tanya’s number.”
    Bob hears this and figures out (2-Lemma). He already had the ‘7X’ information initially given by Tanya.
    So Bob tells Alice “I know Tanya’s number.”

  6. Ben Cordero:

    I’ve written my logic as a python program.
    I don’t think that the answer is 70 as that would be a very boring answer.

    tanyas_set = {i for i in range(1, 100) if i % 7 == 0}
    print(tanyas_set)

    # Alice knows the units value of tanyas_number
    # Alice thinks that Bob does not know tanyas_number from just the tens value.
    # Bob knows the tens value of tanyas_number
    # Bob has some ambiguity about Alice’s knowledge of the number, stays quiet.

    tanyas_reduced_set = lambda x: filter(lambda y: x != y, tanyas_set)

    # => Alice does not know tanyas_number
    alices_set = {i for i in tanyas_set
    if i % 10 in {
    j % 10 for j
    in tanyas_reduced_set(i)}}
    print(alices_set)

    # => Bob does not know tanyas_number
    bobs_set = {i for i in tanyas_set
    if int(i/10) in {
    int(j/10) for j
    in tanyas_reduced_set(i)}}
    print(bobs_set)

    # If tanyas_number == 70, she would know tanyas_number and declare
    # “I know Tanya’s number”.
    # Bob would be very annoyed that Tanya has uniquely identified the
    # number to Alice, but not to Bob. He could then figure it out too.

    # Since Alice does not know tanyas_number,
    # and if they both stay silent, this is as
    # far as their logic can take them.
    shared_set = bobs_set & alices_set
    print(shared_set)

    # But Alice has declared that Bob does not know.
    # Bob can now filter ambiguity in his set.

    shared_reduced_set = lambda x: filter(lambda y: x != y, shared_set)
    bobs_ambiguous_set = {i for i in shared_set
    if int(i/10) in {
    int(j/10) for j
    in shared_reduced_set(i)}}

    # Bob no longer has any ambiguity
    print(shared_set – bobs_ambiguous_set)

    # It’s funny that Bob wouldn’t know tanyas_number
    # if Alice had declared
    # “I do not know Tanya’s number.”

    # It gets really messy if Alice had declared
    # “You know Tanya’s number”.

  7. Maarten Fokkinga:

    || Here is a set of Miranda (and almost Haskell) definitions.
    || Given these definitions, “remainingCandidates” evaluates to [70].
    || Hence the answer is 70.
    || In every line, the part from || to the end of the line is comment.
    || An expression of the form [ E1 | x <- E2; E3 ] stands for the list of
    || all values of E1 where x varies over E1 and satisfies the constraint E3.
    || Symbol # stands for "the length of a list".
    || Function 'and' checks whether all elements of a list evaluate to true.

    || The possible positive integers below 100, divisible by 7, called candidates:
    candidates = [n | n <- [1..99]; n mod 7 = 0]

    || The possible unit-digits y that Alice knows:
    aliceKnows=
    [y | y <- [0..9];
    and [
    || Bob cannot know the number uniquely; i.e., there are at least two candidates with the same ten-digit:
    #[ n | n 1
    |
    || for every ten-digit x of the candidates with unit y:
    x <- [0..9]; member candidates (10*x+y)
    ]
    ]

    || The possible ten-digits x that Bob knows:
    bobKnows =
    [x | x <- [0..9];
    || the candidates with ten-digit x have the unit-digit known by Alice:
    #[n | n <- candidates; n div 10 = x; member aliceKnows (n mod 10)] = 1
    ]

    || The set of candidates after the dialogue:
    remainingCandidates =
    [n | n <- candidates; member aliceKnows (n mod 10); member bobKnows (n div 10) ]

  8. edo-the-awk-king:

    From first sentence you extract numbers {21,28,42,49,70,77,91,98}. If Alice knows the number you must intesect this with the set {35,42,49,56,63,70} obtaining {42,49,70}. If Alice doesn’t knows the number intersect with {07,14,21,28,77,84,91,98} obtaining {21,28,77,91,98}. So from Bob sentence you must exclude the pairs of numbers with same tens. Finally if Alice knows the number it is 70 and if Alice doesn’t knows the number is 77.