MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Binomial Coefficients

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5812] Re: [mg5782] Binomial Coefficients
  • From: Robert Pratt <rpratt at math.unc.edu>
  • Date: Wed, 22 Jan 1997 00:44:16 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Use the KSubsets command found in the standard package 
DiscreteMath`Combinatorica`:

In[1]:= Needs["DiscreteMath`Combinatorica`"]

In[2]:= ?KSubsets
KSubsets[l,k] returns all subsets of set l containing exactly k elements,
   ordered lexicographically.

In[2]:= KSubsets[{1,2,3,4,5},2]

Out[2]= {{1, 2}, {1, 3}, {1, 4}, {1, 5}, {2, 3}, {2, 4}, {2, 5}, {3, 4},

>    {3, 5}, {4, 5}}

Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill
CB# 3250, 331 Phillips Hall
Chapel Hill, NC  27599-3250

rpratt at math.unc.edu

On Sat, 18 Jan 1997, H. Thompson wrote:

> I understand about k-permutations and 'n choose k', and while i can
> mathematically determine the max possible combinations of say a 5 character
> string
> 
> 
> 			n! / [k! (n-k)!]
> I have yet to successfully debug my algorithm so it produces all of the
> calculated permutations.
> 
> 
> Any help would be greatly appreciated.
> 
> 
> hrt
> 
> 



  • Prev by Date: Intro. Mathematica Course on the Web
  • Next by Date: slight correction to Transpose posting
  • Previous by thread: Binomial Coefficients
  • Next by thread: Re: Binomial Coefficients