[Math] the least amount of questions to find out the number that a person is thinking between 1 to 1000 when they are allowed to lie at most once

information theorypuzzle

A person is thinking of a number between 1 and 1000. What is the least number of yes/no questions that we can ask and know what that person's number is given that the person is allowed to lie on at most one of her answers.

Best Answer

This is known as Ulam's problem of searching with lies. For one lie it was first solved by Andrzej Pelc. The minimum number of questions is not hard to calculate but the strategy attaining this number in the worst case takes several pages to describe. Later the solution was simplified.

For $n$ objects with $1$ lie, $n$ even, the number $q$ of questions needed is the smallest solution to $\frac{2^q}{q+1} \geq n$ which is $14$ when $n=1000$. There is a non-adaptive solution using Hamming codes that uses at most one more question than Pelc's method, but can specify all the questions before gameplay begins.