We are going to play a regular “find my number” game, i.e. you announce your initial guess and following my answer ( limited to: “more “, “less” or “right!”) go on to your next guess.
Usually to reveal a number from 1 to N you need no more than log
2N guesses
in the worst case.
How many guesses are needed if I told you that my number
is a 4-digit palindrome divisible by 7 ?
Assume the worst case, of course.
abba mod 7 = (1001*a + 110*b) mod 7 = 5*b mod 7
so b = 7, and a can be any digit from 1 to 9
There are only 9 numbers to choose from.
2^3 = 8, so worst case I will need 4 guesses.
---------------------------------------------------
As is obvious from later valid solutions, I erred in concluding that b can only be 7. Obviously b = 0 or 7, and there are 18 numbers to choose from.
Edited on May 16, 2023, 7:43 am