I want to have my program loop over all possible combinations of something like 5c1,5c2,5c3 etc and calculate some things within the loop.
Something like 5c1 -> 1,0,0,0,0 0,1,0,0,0 0,0,1,0,0 0,0,0,1,0 0,0,0,0,1 (5 ways)
5c2 -> 1,2,0,0,0 1,0,2,0,0 1,0,0,2,0 1,0,0,0,2 2,1,0,0,0 0,1,2,0,0 0,1,0,2,0 0,1,0,0,2 2,0,1,0,0 0,2,1,0,0 0,0,1,2,0 0,0,1,0,2 2,0,0,1,0 0,2,0,1,0 0,0,2,1,0 0,0,0,1,2 2,0,0,0,1 0,2,0,0,1 0,0,2,0,1 0,0,0,2,1 (20 ways) but 1,2,0,0,0 = 2,1,0,0,0 so we get 10 ways
5c3 -> 1,2,3,0,0 0,2,3,1,0 0,2,3,0,1 etc... simplifies 10 ways
so I'm trying to loop to find all the combinations for a general nCr-> n!/[r!*(n-r)!)
I'm stuck on how to do this in code. I'm using Xcode, objective c. I see there is an enumeration method, but it appears to be something different. Any pointers would be greatly appreciated.