A king asks a learned man to visit his palace, to which the learned man responds: “I will come some day next month, but I will not tell you on which day. Further, you must give me gold in grams equal to the date on which I come.”
In preparation for the visit, the king demands that his jeweler make gold rings of 1 to 31 grams.
The wise jeweler made only 5 rings. What are their weights?
The weight of the 5 rings are 1, 2, 4, 8 and 16 grams.
Using the combination of the 5 type of weights you can reward from 1 to 31 grams in weight to the wise man.
For example:
For the 3rd day, you can give him the 1 and 2 gram rings.
For the 15th day, you can give him the 1, 2, 4, 8 gram rings.
For the 30th day, you can give him the 2, 4, 8, 16 grams.