4 integers that can be combined with + or - to make the numbers 1 through 40 - SOLUTION

There are four positive integers, a, b, c, d, which can be combined using plus or minus to get all the integers from 1 to 40 inclusive. These combinations of a, b, c, and d can involve any number of a, b, c, and d, but none of these four integers can be used more than once. That is, some possible combinations are:

However, these types of combinations are not allowed:

What are the four integers?


Much like the consecutive powers of 2 (from 2^0 to 2^n) can be combined in different ways with addition to get all possible integers from 1 to (2^(n+1) - 1), the consecutive powers of 3 (from 3^0 to 3^n) can be combined using addition and subtraction to get all the possible integers from 1 to (3^0 + 3^1 + ... + 3^n). The four integers are 1, 3, 9, and 27.

Ken Ho's home page