I have a list of let's say 256 random 32 bit numbers. I need to come up with some sum of a number of them that mod 2^32 sums to a particular number. This sum should involve the fewest terms. Hopefully 4 or so would suffice.

If this were xoring instead of summing you could do this with Gaussian elimination and the sum would involve about 32 terms and you wouldn't need many more than 32 random numbers.

Hopefully with more random numbers the number of terms can be reduced.

The 32 bit example above is a "toy" version. The solution has to scale to large numbers.

I imagine this is a well solved, common problem if only I knew how it was referred to in the literature.

Thanks in advance!