I am calculating some chemistry for which i need combination of values which total equals N number. I have following array for which each values can't be more than X
Array :
Index | Max Value
0 | 370
1 | 185
2 | 740
3 | 277.5
4 | 277.5
5 | 1850
6 | 925
7 | 1850
i need a function which will calculate all possible combination of values from each array index which total equals 1850.
Eg.
0 | 77.00
1 | 700.00
2 | 50.00
3 | 300.00
4 | 700.00
5 | 15.00
6 | 7.00
7 | 1.00
which Total = 1850
Thanks in advance for your help