I would like a formula for the following:

Lets say I have a number x that is equal to 240

I would like a formula from the following information for all variations that will give me x or greater.

The following will be true:

There will always be numbers 1 through 6

You will know how many of each there are (1 six, 1 five, 1 four, 16 threes, 2 twos and 3 ones as an example). there may be 0 or n but most likely n will not be over 50.

For each group above (like the 2 two's) , each occurrence can have a factor of 0,1,2,3 or 4. So for instance….the 2 two’s could be 1 four and 1 three. The 16 three’s could be 5 fours, 5 threes, 3 twos, 1 one and 1 zero. You then multiply every 0-4 by the grouping 1-6 and then by the occurrence and add them together.

For example the group of twos of 4 and 3 would be 4*2*1 + 3*2*1 = 14 the group of 3’s would be 4*3*5 + 3*3*5 + 2*3*3 + 1*3*1 + 0*3*1 = 126

Summing all the groupings 1-6 together needs to be >= x

How can I come up with every combination that will give 240 or higher?

One such combination is

1 6 which is a 4 = 24

1 5 which is a 4 = 20

1 4 which is a 4 = 16

16 3’s which are 1-1,2-2s, 6-3s,7-4s = 153

2 2’s which are both 4s = 16

3 1’s which are 1-3 and 2-4s = 11

Add together and you get 240

i would like a way to figure out every possible combination for 240 and higher without writing a program to get every single combination and then testing for 240 or higher.

can anyone help. i hope i posted this in correct subject.