Hi, Related to my last question is the following. Does anyone have code to write out every possible combination (not permutation) from a given number X taken out Y (X choose Y)? Any help appreciated. i just cannot seem to get the appropriate number written out. Thx Marc
combination Try this link http://en.wikipedia.org/wiki/Mathematical_combination as an example - to choose 3 out of 10 you have : 10! / (3! * (10-3)!) = 3628800/(6*5040) = 120 (calculated by SCalculator , since the only code you need is Factorial function, you can find it there.)
combination Here is conceptual code, not debugged: sub combination(x,y) a = 1 for i = 1 to x a = a*i next b = 1 for i = 1 to y b=b*i next c=1 for i = 1 to x-y c= c*i next return a/(b*c) end sub
Okay, I took the challenge ! see the attached program, both displaying and storing in a file. fill the a out of b and press go. you will get the number of combinations and the last one, and you can brouse up and down.