There has been some discussion of this in a newer question, where you will find a detailed exposition and a certain amount of disagreement; but I will summarise the information-theoretic aspects here.
The key is to note the correct information content of the problem. Let us suppose that $Q$ questions are to be asked. I will cause irritation and confusion by supposing that the values to be guessed are in the half-open interval $[0,N)$ rather than the closed one you specified. This means that there are exactly $N$ possibilities to be guessed, rather than $N+1$, and it makes the algebra easier to read. The other change in notation is that I will refer to the questions as being of the form "$x<k$?".
The answerer has to have two pieces of information to do his job. One is the number $n$ to be guessed: $N$ possibilities. The other is the number $q$ of the question which he is to answer with a lie. $q$ does lie in the closed interval $[0,Q]$, because we can take $q=Q$ to mean "the answerer never lies". Thus the total number of possibilities between which the answerer has to choose is $(Q+1)N$.
The questioner can't reach his conclusion without deducing all the information that the answerer needed to produce his answers: thus, $(Q+1)N$ possibilities. Another way of looking at it is that when the questioner has guessed the number $n$, he also knows the number $q$.
Since each question can distinguish between two possibilities only, $Q$ questions are needed to distinguish between $2^Q$ possibilities. Thus, comparing the possibilities distinguishable by $Q$ questions with the possibilities that need to be distinguished, we have $$2^Q\ge(Q+1)N$$
I shall present an algorithm which, I claim, is within one or two units of achieving a successful guess with the smallest integer $Q$ that satisfies the above equation.
The strategy
The questioner's strategy is to play $Q+1$ games simultaneously: one in which the answerer lies at question $0$, one in which he lies at question $1$, and so on up to question $Q-1$; plus one in which the answerer doesn't lie at all (which it is not illogical to describe at "lies at question $Q$", since question $Q$ is never asked).
At each stage, the questioner asks one and only one question, "is $x<k$?", and applies the answer to all $Q+1$ simultaneous games. Thus the answerer only hears $Q$ questions, as required.
At the start, each game has all $N$ numbers as possibilities. Each answer to a question reduces that number. It should be noted that there is no question of lying in these sub-games: each one receives, at each stage, a true answer. All the questioner has to remember is that the answer to question $q$ should be inverted ("Yes" becomes "No" and "No" becomes "Yes") for game $q$, to allow for the fact that game $q$ is the one in which answer $q$ is a lie.
As time goes on, the possible numbers resulting from each of the $Q+1$ games become fewer and fewer. For some games they all disappear, and eventually they disappear for all games except one, and in that game only one number is left. At that point the number is known, and the identity of the game which still contains that number gives the number of the question that was answered falsely (with, as before, game number $Q$ denoting "there were no false answers").
The strategy at step $q$ is therefore:
- Define $N_q$ as the number of possible numbers, totalled across all games (thus, the number of possible $\langle n,q\rangle$ pairs). Clearly $N_0=(Q+1)N$.
- Ask a question "$x<k$?" such that a Yes answer eliminates precisely half of the possible numbers, totalled across all games. Then a No answer will also eliminate half the possible numbers. We can say that $N_<=N_\ge=\frac12N_q$.
- Given the answer, eliminate all numbers in game $q$ which do correspond to the answer, because in this round the answer to game $q$ is a lie so that "$x<k$" means that $x$ is greater than or equal to $k$. In all other games, eliminate all numbers which do not correspond to the answer, because in this round the answer to all games other than $q$ is true.
- You now have either $N_{q+1}=N_<$ or $N_{q+1}=N_\ge$: that is to say, $N_{q+1}=\frac12 N_q<$ if $k$ was chosen perfectly.
The possibility of choosing $k$
At any stage, games can be of three kinds:
- Games in which the lie has already been told.
- Games in which the lie is being told in the current round.
- Games in which the lie will be told in the future (or will never be told).
The ranges of numbers covered by class (1) are all disjoint (since each game comes from a different sequence of Yes/No after allowing for lies). Classes (2) and (3) all contain identical ranges to each other, but that range is disjoint from any of the class (1) ones.
The effect of this on the value of $N_<$ for various potential values of $k$ is as follows:
- Wherever $k$ is in class (1), $dN_</dk=+1$. That is, each increase of 1 in "$x<k?$" yields an increase of 1 in the number of numbers that remain possible if the answer is Yes.
- Wherever $k$ is in class (2) or (3), $dN_</dk=Q-q-2$. That is, each increase of 1 in "$x<k?$" yields an increase of $Q-q-2$ in the number of numbers that remain possible if the answer is Yes. This is because there are $Q-q-1$ games in class (3) and they all share the same range of possibilities and are all affected by answers in the same way, and there is $1$ game in class (2) which shares the same range, but for which the number of possible numbers decreases by 1 unit for each 1-unit increase in $k$. (The reverse direction is because a "Yes" to "$x<k?$" means, for class (2), "No").
- If $k$ is not in any of these classes, $dN_</dk=0$.
Leaving aside occasional flat spots, the graph of $N_<$ versus $k$ is therefore monotone. Where the slope is 1, it is easy to find a $k$ such that $N_<=\frac12N_q$. This would yield an explicit algorithm which halves the number of possibilities at each stage and therefore reaches a conclusion in the minimum theoretical time.
The only time where this breaks down is when the slope is not 1 at the point where the horizontal line $N_<=\frac12 N_q$ intersects the graph. In that region $N_<$ jumps by $Q-q-2$ units for each one-unit step in $k$. This means that the attainable value of $N_<$ closest to $\frac12 N_q$ could be $\frac12(Q-q-2)$ units away from it. This, in turn, means that rather than having the ideal $$N_{q+1}=\frac12 N_q$$ we may have $$N_{q+1}=\frac12 N_q+\frac12(Q-q-2)$$
This slightly slows the progress of the game, and it makes explicit analysis difficult; but since the largest value of $(Q-q-2)$ will be of the order of $\log_2{N}$, it will be seen that it does not have an overwhelming effect on progress.
The algorithmic complexity of finding the right value of $k$ is essentially logarithmic. It is a question of sorting the available ranges into order; a binary search to find the range which brackets the desired value of $N_<$; and simple arithmetic to find the desired value in the range.