Re: Combinations and Counting
- To: mathgroup at smc.vnet.net
- Subject: [mg118926] Re: Combinations and Counting
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Mon, 16 May 2011 03:34:42 -0400 (EDT)
You say you want a program that "counted" the combinations, but then you
seem to be suggesting that you really want the actual subsets. Which?
If the former -- just the count -- then no "program" in the usual sense
of the word is required. Just formation of a table:
Table[Binomial[n, k], {n, 1, 20}, {k, 1, n}] // TableForm
And if you want to see the corresponding {n,k} values:
Table[{{n, k}, Binomial[n, k]}, {n, 1, 20}, {k, 1, n}] // TableForm
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?
>
> Thanks!
>
> DR
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305