I know nothing about coding and I'm pretty sure this can be easily done with some script or stuff like that.

My problem is that I would like to find all the combinations possible for this:
A+B+C+D=8
A+B+C+D+E= -7
A+B+C+D+E= -21
A+B+C+D+E+F= -18

ABCDEF are numbers from this pool: -27;-21;-16;-16;-15;-15;-14;-12;-8;-7;-7;-3;-3;-2;0;1;2;3;4;8;11;12;17;20;29.
They can be used only once for each equations and the equations are independent. (for example: "0" can be used in the 4 equations but only 1 time in each combination)

I already did by hand the combinations for 4 other equations but it takes hours and I probably missed some of them.

I hope I explained the problem well enough, ask me questions if not, so If anyone can help me with this, that would be awesome!

Edit: the pool of numbers is the same for each time, you can re-use a number in different combination.

Edit2: problem solved, thanks CrafterKolyan!!

6 years ago*

Comment has been collapsed.

I could probably make a quick script to brute force it, but do you only need the solution? And what's it for? It doesn't look like anything meaningful will come out of those equations or those numbers.

EDIT: Unfortunately it's going to get a bit more complicated when you need every single solution. I'll have to withdraw my offer. I'd still be able to make it but it'd take more time than I can spare.

6 years ago*
Permalink

Comment has been collapsed.

but do you only need the solution

What do you mean?
Gothemasticator answered below 1 possible combination for each, so I'll take the first for example, 0+1+3+4=8 is the same for me as 1+0+3+4=8 or 4+1+0+3=8. It's not every single combinations possible but only those with different numbers (it can be 2 differents or all of them).

6 years ago
Permalink

Comment has been collapsed.

A+B+C+D=8
0+1+3+4=8

A+B+C+D+E=-7
0+1+3+4+(-15)=-7

A+B+C+D+E=-21
(-8)+8+(-12)+12+(-21)=-21

A+B+C+D+E+F=18
(-8)+8+(-12)+12+17+1=18

Is it more difficult than I am making it? That pool of numbers with it's positive-negative pairs makes this easy.

6 years ago
Permalink

Comment has been collapsed.

I think the difficulty lies in having to find every possible combination. I did also misread that at first.

6 years ago
Permalink

Comment has been collapsed.

Yes there is dozens and dozens of possible combinations unfortunately, making it very time consuming doing by hand. I gave up after hours doing that for 4 other equations.

6 years ago
Permalink

Comment has been collapsed.

Ah! Thank you. I did misunderstand that part.

6 years ago
Permalink

Comment has been collapsed.

Do you need all the permutations?
I mean 0 + 1 + 3 + 4 = 8 and 4 + 3 + 1 + 0 = 8 should differ or not?

6 years ago
Permalink

Comment has been collapsed.

No need of the permutations, look above I just answered that to DanZDK.

6 years ago
Permalink

Comment has been collapsed.

That's for A + B + C + D = 8.

-27 + -14 + 20 + 29 = 8
-27 + -2 + 8 + 29 = 8
-27 + -2 + 17 + 20 = 8
-27 + 2 + 4 + 29 = 8
-27 + 3 + 12 + 20 = 8
-27 + 4 + 11 + 20 = 8
-21 + -12 + 12 + 29 = 8
-21 + -8 + 8 + 29 = 8
-21 + -8 + 17 + 20 = 8
-21 + -3 + 3 + 29 = 8
-21 + -3 + 12 + 20 = 8
-21 + -3 + 3 + 29 = 8
-21 + -3 + 12 + 20 = 8
-21 + -2 + 2 + 29 = 8
-21 + -2 + 11 + 20 = 8
-21 + 0 + 12 + 17 = 8
-21 + 1 + 8 + 20 = 8
-21 + 1 + 11 + 17 = 8
-21 + 4 + 8 + 17 = 8
-16 + -16 + 11 + 29 = 8
-16 + -8 + 3 + 29 = 8
-16 + -8 + 12 + 20 = 8
-16 + -7 + 2 + 29 = 8
-16 + -7 + 11 + 20 = 8
-16 + -7 + 2 + 29 = 8
-16 + -7 + 11 + 20 = 8
-16 + -3 + -2 + 29 = 8
-16 + -3 + -2 + 29 = 8
-16 + 0 + 4 + 20 = 8
-16 + 1 + 3 + 20 = 8
-16 + 1 + 11 + 12 = 8
-16 + 3 + 4 + 17 = 8
-16 + 4 + 8 + 12 = 8
-16 + -8 + 3 + 29 = 8
-16 + -8 + 12 + 20 = 8
-16 + -7 + 2 + 29 = 8
-16 + -7 + 11 + 20 = 8
-16 + -7 + 2 + 29 = 8
-16 + -7 + 11 + 20 = 8
-16 + -3 + -2 + 29 = 8
-16 + -3 + -2 + 29 = 8
-16 + 0 + 4 + 20 = 8
-16 + 1 + 3 + 20 = 8
-16 + 1 + 11 + 12 = 8
-16 + 3 + 4 + 17 = 8
-16 + 4 + 8 + 12 = 8
-15 + -14 + 8 + 29 = 8
-15 + -14 + 17 + 20 = 8
-15 + -8 + 2 + 29 = 8
-15 + -8 + 11 + 20 = 8
-15 + -7 + 1 + 29 = 8
-15 + -7 + 1 + 29 = 8
-15 + -3 + -3 + 29 = 8
-15 + -2 + 8 + 17 = 8
-15 + 0 + 3 + 20 = 8
-15 + 0 + 11 + 12 = 8
-15 + 1 + 2 + 20 = 8
-15 + 2 + 4 + 17 = 8
-15 + 3 + 8 + 12 = 8
-15 + 4 + 8 + 11 = 8
-15 + -14 + 8 + 29 = 8
-15 + -14 + 17 + 20 = 8
-15 + -8 + 2 + 29 = 8
-15 + -8 + 11 + 20 = 8
-15 + -7 + 1 + 29 = 8
-15 + -7 + 1 + 29 = 8
-15 + -3 + -3 + 29 = 8
-15 + -2 + 8 + 17 = 8
-15 + 0 + 3 + 20 = 8
-15 + 0 + 11 + 12 = 8
-15 + 1 + 2 + 20 = 8
-15 + 2 + 4 + 17 = 8
-15 + 3 + 8 + 12 = 8
-15 + 4 + 8 + 11 = 8
-14 + -8 + 1 + 29 = 8
-14 + -7 + 0 + 29 = 8
-14 + -7 + 12 + 17 = 8
-14 + -7 + 0 + 29 = 8
-14 + -7 + 12 + 17 = 8
-14 + -3 + 8 + 17 = 8
-14 + -3 + 8 + 17 = 8
-14 + -2 + 4 + 20 = 8
-14 + 0 + 2 + 20 = 8
-14 + 1 + 4 + 17 = 8
-14 + 2 + 3 + 17 = 8
-14 + 2 + 8 + 12 = 8
-14 + 3 + 8 + 11 = 8
-12 + -8 + 8 + 20 = 8
-12 + -8 + 11 + 17 = 8
-12 + -7 + -2 + 29 = 8
-12 + -7 + -2 + 29 = 8
-12 + -3 + 3 + 20 = 8
-12 + -3 + 11 + 12 = 8
-12 + -3 + 3 + 20 = 8
-12 + -3 + 11 + 12 = 8
-12 + -2 + 2 + 20 = 8
-12 + 0 + 3 + 17 = 8
-12 + 0 + 8 + 12 = 8
-12 + 1 + 2 + 17 = 8
-12 + 1 + 8 + 11 = 8
-8 + -7 + 3 + 20 = 8
-8 + -7 + 11 + 12 = 8
-8 + -7 + 3 + 20 = 8
-8 + -7 + 11 + 12 = 8
-8 + -3 + 2 + 17 = 8
-8 + -3 + 8 + 11 = 8
-8 + -3 + 2 + 17 = 8
-8 + -3 + 8 + 11 = 8
-8 + -2 + 1 + 17 = 8
-8 + 0 + 4 + 12 = 8
-8 + 1 + 3 + 12 = 8
-8 + 1 + 4 + 11 = 8
-8 + 2 + 3 + 11 = 8
-7 + -7 + 2 + 20 = 8
-7 + -3 + -2 + 20 = 8
-7 + -3 + 1 + 17 = 8
-7 + -3 + -2 + 20 = 8
-7 + -3 + 1 + 17 = 8
-7 + -2 + 0 + 17 = 8
-7 + 0 + 3 + 12 = 8
-7 + 0 + 4 + 11 = 8
-7 + 1 + 2 + 12 = 8
-7 + 1 + 3 + 11 = 8
-7 + 3 + 4 + 8 = 8
-7 + -3 + -2 + 20 = 8
-7 + -3 + 1 + 17 = 8
-7 + -3 + -2 + 20 = 8
-7 + -3 + 1 + 17 = 8
-7 + -2 + 0 + 17 = 8
-7 + 0 + 3 + 12 = 8
-7 + 0 + 4 + 11 = 8
-7 + 1 + 2 + 12 = 8
-7 + 1 + 3 + 11 = 8
-7 + 3 + 4 + 8 = 8
-3 + -3 + 2 + 12 = 8
-3 + -3 + 3 + 11 = 8
-3 + -2 + 1 + 12 = 8
-3 + -2 + 2 + 11 = 8
-3 + 0 + 3 + 8 = 8
-3 + 1 + 2 + 8 = 8
-3 + -2 + 1 + 12 = 8
-3 + -2 + 2 + 11 = 8
-3 + 0 + 3 + 8 = 8
-3 + 1 + 2 + 8 = 8
-2 + 0 + 2 + 8 = 8
0 + 1 + 3 + 4 = 8

6 years ago
Permalink

Comment has been collapsed.

Oh thank you so much, that's what i'm looking for.
You're the man!!

6 years ago
Permalink

Comment has been collapsed.

A + B + C + D + E = -7 -> https://pastebin.com/GspcU5ke
A + B + C + D + E = -21 -> https://pastebin.com/dQ2JdKV0
A + B + C + D + E + F = -18 -> https://pastebin.com/hXzUErmf

6 years ago
Permalink

Comment has been collapsed.

WOW, that's almost 4k combinations in total, no way I could have done that by hand.
Thank you again dude!

6 years ago
Permalink

Comment has been collapsed.

As you have a limited number of options for ABCDEF doing this by hand should not take you more than 30 minutes,

edit:Just reread and see the ecuations are independent so may take long :P.

6 years ago*
Permalink

Comment has been collapsed.

Equations are independent, so the A for the first one can be different for the others.

6 years ago
Permalink

Comment has been collapsed.

Yeah I missed that line ;P

6 years ago
Permalink

Comment has been collapsed.

Closed 6 years ago by Asulf.