Originally Posted by

**Celcius** The postage stamp problem is a mathematical riddle that asks what is the smallest postage value which cannot be placed on an envelope, if the letter can hold only a limited number of stamps, and these may only have certain specified face values.

For example, suppose the envelope can hold only three stamps, and the available stamp values are 1 cent, 2 cents, 5 cents, and 20 cents. Then the solution is 13 cents; since any smaller value can be obtained with at most three stamps (e.g. 4 = 2 + 2, 8 = 5 + 2 + 1, etc.), but to get 13 cents one must use at least four stamps.

Is there an algorithm that given the maximum amount of stamps and the face value of the stamps, one can find the smallest postage that cannot be placed on the envelope?

Another example:

Maximum of 5 stamps can be used

Valued: 1, 4, 12, 21

The smallest value that cannot be reached is 72. Values 1-71 can be created with a certain combination.