Find all combinations that add up to a given number


Combos_2023Dec12a.gh (14.2 KB)

Python:

__author__ = "Joseph Oster"
__version__ = "2021.01.15"

from itertools import combinations  

combos = []
for i in range(2,len(vals)+1):
    comb = combinations(vals, i)
    for c in list(comb): 
        combos.append("+".join(c))

C = combos

Based on this: