This is Subset Sum and is famously NP-complete so, no, an LP doesn't work. However, the problem is only weakly NP-hard and there is a pseudo-polynomial time algorithm running in time O(M • n) where M is the sum and n is the number of accounts.<p>The problem is, perhaps, most of all, that it takes the same amount of space.<p>Ps, it's not a permutations problem, but a subsets problem. While permutations is n! subsets are "only" 2^n.