Originally Posted by

**aRTx** Thnx, but is there any way to find the number of tables because we have many replication of combinations...

Look: I have generate combination of k=2 from n=9 and I have transform in all of possible tables

The first table is the main table of our combination n=9 and k=2 but the in the other tables are all of these combination.

My question is:

If i have n=49 and k=6 and we made tables with 12-rows then how many tables we will have (exact) to include all of these combination?

thnx very much!

It is very important for me...

I'm still no nearer to helping you with the general problem, but you can certainly improve on the algorithm that you are using. For example, when n=9 and k=2, the table with three rows includes three triples containing both 4 and 5. That is wasteful. You can reduce the number of columns from 16 to 12 (the minimum possible) like this:

$\displaystyle \begin{matrix}1&4&7&1&2&3\\ 2&5&8&4&5&6 \\ 3&6&9&7&8&9\end{matrix}\kern10pt\begin{matrix}1&2& 3&1&2&3\\ 5&6&4&6&4&5 \\ 9&7&8&8&9&7\end{matrix}$

For ideas on how to produce tables in the case where k=2, you could try googling for things like round robin tournament algorithm. When k=2 and the number of rows in the table divides n (the total number of elements in the pool), there is probably an efficient algorithm for achieving the minimum number of combinations. In your case, 7 (the number of rows) does divide 49 (the number of elements), which may mean that the problem has a good solution. But you are taking k=6, which makes the combinatorial problem massively more complicated and possibly takes you into unexplored territory. Sorry I can't help you further.