Equally dividing a set of integers into parts of as equal sums as possible while maintaining a close number of integers within each set

52 Views Asked by At

Say for example, I have a set of integers $$S = \{1, 2, 3, \cdots , 8, 9, 10\}$$ and I want to divide these integers into $4$ sets, each set with a similar number of integers, but simultaneously with each set having similar sums.

One solution might be like: $$S_1 = \{10, 3, 2\}, S_2 = \{9, 4, 1\}, S_3 = \{8, 5\}, S_4 = \{7, 6\}$$, where the sums are $$S_1 = 15, S_2=14, S_3=13, S_4=13$$, and the number of integers in each set are $$S_1 = 3, S_2=3, S_3=2, S_4=2$$.

So the sums are "pretty close" to each other, as well as the number of integers in each set. Of course there are other solutions, but is there a general way I can find solutions with larger sets of integers? Like if I had $100$ random integers, how would I go about finding one of the solutions to that problem?