Smallest number can't be made with linear combination of unique positive integers

288 Views Asked by At

I'm given a set of numbers, let's say {2, 6, 9}. I have to find smallest number greater than largest number in the set, which can't be represented as linear combination of numbers in the set.

In other words, an integer x such that x = c1*2 + c2*6 + c3*9 has a solution and x is closest to the largest number in the set. For this set, there's no such answer. In the example give, there's no such smallest integer since every integer > 9 can be represented as linear sum of these three.

What's the general answer ?