Good Day

Lets say i have a array of integers....

-always differs in length

I need to know all the possibilities the numbers in the string have to add up to a certain number.

let say 5;

and my array contains 1,3,4,3,5,8,2,1;

than the possibilites would be.... (3,2)(4,1)(3,1,1)

But i also need to know the index which they where gotten from..... for tracking purposes.

Also, since thier are 2 possibilites of 3,2, it would have to used the last 3 that it find..... this case it would be 3 from the 3rd index, and 1 from index 0, and next 1 from index 7;

Could anyone help me with this?

Thanks

Scheppy