rec.puzzles Archive

A computer generates a number between 1 and 100 (both inclusive), according to a known probability...

decision/guess.weighted.number New

New entry, edited from material collected for the archive and not yet in a released version.

Problem

A computer generates a number between 1 and 100 (both inclusive),
according to a known probability distribution, i.e., you are given the
probabilities of each of the numbers from 1 to 100.  Each number is
worth a certain amount of money.  For simplicity, assume 1 is worth $1,
2 is worth $2, ..., 100 is worth $100.  You are allowed to ask the
computer at most 6 questions of the form "Is the number equal to X?"
(put your favorite number in place of X), to each one of which the
computer may give you one of three replies -- "Yes", "You're too
high", or "You're too low" (the computer doesn't lie).  If you guess
the number correctly, you win the money it's worth.  What's the
strategy you must adopt to maximize your winnings?

Note that questions cannot be of the form "Is the number an element of
the set {a,b,c...}?", so drawing Huffman trees will not help...

-- Navin Kashyap <nkashyap@engin.umich.edu>
Show solution
Simply choose the 63 most profitable numbers (that is those with
highest probability*value products) and do a binary search on them.

-- J.M. Robson <robson@LaBRI.U-Bordeaux.FR> (November 1997)