I am thinking of an integer n with 0 <= n <= 15.

To figure out what number I'm thinking of, you can ask me 7 yes-or-no questions -- questions that can only be answered with either "yes" or "no".

The questions must be independent of each other, their answers, and the order in which they are answered. (So you can't ask a question like, "if the answer to the previous question was "yes", then is n larger than 10, otherwise is n even?")

When you ask me your seven questions, I am allowed to LIE about at most one of the answers. What seven questions can you ask to determine n?

Prior to asking my questions I would ask you to write your number in a binary
base (4 bits)

and then add 3 parity check bits to
create a 7- bit Hamming word.

<o:p> </o:p>

If you do not know how to do it - http://users.cs.fiu.edu/~downeyt/cop3402/hamming.html

will provide the necessary guidance.

<o:p> </o:p>

Then I will ask you (in any order) my
7 independent questions:

<o:p> </o:p>

Is the leftmost bit 1?

Is the 2^{nd} from left bit 1?

……etc

Is the rightmost bit 1?

You can either answer truthfully or
lie once.

No problem – 2^3 combination will
indicate the erroneous place (7 possibilities) or

will warrant the right data.

<o:p> </o:p>