I've searched now for more than two days around the web for any working solution. But maybe I just need the right "word" to google for. Let me explain, what I want. Just found lot of articles of combinations and permutations, but they're not covering my requirements (or I don't understand how to do this).
Let's assume, that I'll have a list of numbers: [1, 2, 3]
Now, I want all possible combinations of them. I need that kind of result (for the given example):
1 2 3
1 2+3
1+2+3
2 1+3
3 1+2
Those are all available combinations (hope so). I don't need repetition, so 1 2+3
is the same as 1 3+2
.
Is there any Math genius who may help me with it? Is there any formula I can calculate the result count?
Trying to solve it in PHP but it oftens end in endless recursive executions and a memory limit exception.