Hi,
I want to enumerate all possible combinations of N balls in A boxes.
example: I have 8 balls to deal in 3 boxes :
box_1 box_2 box_3
case-1 8 0 0
case-2 0 8 0
case-3 0 0 8
case-4 7 1 0
case-5 7 0 1
case-6 6 2 0
...
My first problem is that I need A loops to perform this but I want that A and N to be user's inputs. So how to do without writing all possible number of loops users could need?
a and N will be value between 2 and ~800, so it will be strongly demanding in computation time so. How to optimize that algorithm?
I would be grateful if you answer me using python language. thanks for all contributions!