I once got the following as an interview question:
I\'m thinking of a positive integer n. Come up with an algorithm that can guess it in O(lg n) quer
Remember that any rational number in (0, 1) can be represented as a finite sum of distinct (positive or negative) unit fractions. For example, 2/3 = 1/2 + 1/6 and 2/5 = 1/2 - 1/10. You can use this to perform a straight-forward binary search.