Brain-Teaser 511: What’s my age?
From The Sunday Times, 28th March 1971 [link]
I recently had an odd letter from a puzzle addict, who wrote:
“I know that you are between 25 and 80, and I’ve made a bet (at fair odds) that I can deduce your age from your Yes/No answers to the following questions:
1. Are you under 55?
2. Is your age a prime number?
3. If the digits of your age are reversed, is the result prime?
4. Is the digital root of your age even?Please reply on enclosed stamped postcard.”
I did so, and had a reply a few days later:
“Many thanks. As soon as I read your first three answers I knew that the fourth answer must lead me to your age. You are …” (and he gave a figure wrong by well over 20 years).
Puzzled, I rechecked my four answers and found to my horror that I had carelessly transposed two of them and so had misled him.
How old am I?
This puzzle is included in the book Sunday Times Brain Teasers (1974).
[teaser511]
Jim Randell 2:32 pm on 26 November 2019 Permalink |
This Python program runs in 73ms.
from enigma import (defaultdict, irange, is_prime, nreverse, digrt, subsets, update, printf) # collect <answers> -> <ages> d = defaultdict(list) # consider possible ages for n in irange(25, 80): # the statements ss = ( # 1. "Age is under 55?" (n < 55), # 2. "Age is prime?" is_prime(n), # 3. "Reverse of age is prime?" is_prime(nreverse(n)), # 4. "Digital root of age is even?" (digrt(n) % 2 == 0), ) d[ss].append(n) # generate sequences with two (different) values swapped def swap(s): s = list(s) # swap two of the values for ((i, x), (j, y)) in subsets(enumerate(s), size=2): if x != y: yield tuple(update(s, [(i, y), (j, x)])) # find values for the first three questions where the final question gives a definite answer Bool = (True, False) for k in subsets(Bool, size=3, select="M"): # possible mistaken keys ks = list(k + (x,) for x in Bool) # each must lead to a single answer if not all(len(d[k]) == 1 for k in ks): continue # consider possible mistaken keys for k in ks: m = d[k][0] # mistaken age # look for possible real keys for r in swap(k): # possible real age for n in d[r]: # must be more than 20 years difference if abs(n - m) > 20: printf("age = {n}, real = {r}; swap = {k}, age = {m}")Solution: The setter’s age is 71.
There is only one set of values for the answers to the first three questions that lead to two ages that can be differentiated by the answer to the fourth question.
If all the first three questions are answered “Yes”, then:
The setter then discovers that he has exchanged the places of two of the answers.
So the answer sent cannot be: (“Yes”, “Yes”, “Yes”, “Yes”), as swapping any two of them would make no difference.
So the sent answers must have been: (“Yes”, “Yes”, “Yes”, “No”). Leading the puzzler to believe that the setters age was 37.
But this is incorrect “by well over 20 years”, so the setter must be much less than 17 (not possible) or much more than 57.
If we move the “No” into different positions we get:
Only the first of these gives an age much more than 57, so the answers for the first and fourth question were accidentally swapped.
LikeLike