as an addendum to what @matszwecja said, perform your exact match test against a set of existing sums, as in the "two sum" problem. If the numbers are always positive, you can prune any results greater than {target}-{minimum}