# how to check Recursively if i can create a sum from a list of numbers? [closed]

To determine whether you can create a sum from a list or sublist of numbers:

2) If that number is equal to the sum you’re trying to create, stop, you’ve succeeded.

3) If that number is greater than the sum you’re trying to create, skip to the next number and go to step 2.

4) Subtract that number from the sum you’re trying to find.

5) Repeat this algorithm, trying to find the remaining sum with the remaining numbers (those after this one).

6) Go to the next number. If there is none, stop.

7) Go to step 2.

So, for example, if you’re trying to find a sum of 55 from [1, 13, 17, 8], you can reduce that to these three questions:

1. Can you find a sum of 55-1 from [13, 17, 8]? (This will find any solutions that include the first number.)

2. Can you find a sum of 55-13 from [17, 8]? (This will find any solutions that don’t include the first number but do include the second.)

3. Can you find a sum of 55-17 from [8]? (This will find any solutions that don’t include the first or second number but do include the third.)

4. Is 8 the solution? (This will find any solutions that don’t include the first three numbers but do include the fourth.)

Notice each new question has fewer terms than the original question. So it won’t go on forever.