Re: Combinations and Counting
- To: mathgroup at smc.vnet.net
- Subject: [mg118925] Re: Combinations and Counting
- From: Helen Read <readhpr at gmail.com>
- Date: Mon, 16 May 2011 03:34:32 -0400 (EDT)
- References: <iqoc0v$m8r$1@smc.vnet.net>
On 5/15/2011 7:05 AM, Dean Rosenthal wrote: > What might be the most efficient way to write a little program that counted > combinations in the following way: > > 1 choose 1, 2 choose 1, 2 choose 2, 3 choose 1, 3 choose 2, 3 choose 3, 4 > choose 1, 4 choose 2, 4 choose 3 ... continuing the pattern ... > > So that I would be able to derive each subset in that order? Invoking > "subsets" in the most rudimentary way *almost* gets me there, but I would > like to see the output of this series of combinations in this special order, > in column form, and be able to carry out my search much further. > > Suggestions? Is this what you mean? Grid[Table[Binomial[n, k], {n, 0, 10}, {k, 0, n}]] If you want the rows centered, try this. Column[Table[Binomial[n, k], {n, 0, 10}, {k, 0, n}], Center] With a little effort you can eliminate the braces and commas from that last one. table = Table[Row[{" ", Binomial[n, k], " "}], {n, 0, 10}, {k, 0, n}]; Column[Map[Row[#] &, table], Center] -- Helen Read University of Vermont