Help to fill a numbers tables

Hello,
Can you help me please, i have a table of numbers for example
1, 6, 18, 19, 25, 7, 3, 24
and i am searching all the combinaisons we can do between the numbers to make number1+number2=number3 (only this a+b=c, 1+6=7)
i need to know if it’s possible to use all the numbers of the table and only once

Not for that table, I don’t think, the number of elements is not a multiple of three.

I think what you want to research is probably “backtracking”.

not sure to understand you, here is my table 03,04,05,08,15,16,20,24,26,28,29,31,35,39,44,45,53,55,58,60,67,68,72,75,76,80, 03, 53, 76, 28

i need to see if it’s possible you use all these 30 numbers once by doing nb1+nb2=nb3

I’m suggesting a word to search for on Google to learn how to do this yourself, rather than solving your homework for you :slight_smile:

it’s my homerwork :wink:
it’s for a game, i have done it manually but i can do mistake
i just want to be sure with a script, but i am very very bad on scripting

If you already did it manually, then just write a program to check your sums and make sure you used the right set of numbers. Much simpler!

My bad, it s not for homework.
I don’t code so I do not know how do to

Well, start with how would you do your task live with numbers on pieces of paper and a wall/blackboard. Start with small set and try to think over the steps. Then write your algorithm in pseudocode using “normal”, human instructions. Post them here, and we will check them :slight_smile:

For your information: there exist a Python function that given a list produces all combinations of its elements. So, at least you can consider this part of your program “done” :wink:

1 Like