MathGroup Archive 2004

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

Search the Archive

All combinations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47357] All combinations
  • From: János <janos.lobb at yale.edu>
  • Date: Tue, 6 Apr 2004 06:36:56 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I need in a list of all 'k' length combinations of set of 'n' different 
elements where k can be smaller or bigger than n.  For example if I 
have n=4 and the set is {a,b,c,d} then all combinations of k=7 length 
would be

{{a,a,a,a,a,a,a}
{a,a,a,a,a,a,b}
{a,a,a,a,a,b,a}
...
...
{d,d,d,d,d,d,d}}

and the Length of it is about 4^7, in general n^k.

I looked <<DiscreteMath`Combinatorica and  found Permutations, but it 
is just a subset I am looking for.  I can program it out, but would 
prefer a built in or add-on functions if one is already there.

Can you point me to the right direction ?

Thanks ahead,
János
-----------------------------------------------------
So, while openness provides a couple of security advantages in itself, 
the chief reason why Linux and BSD offer superior security is not so 
much because they're open source, but because they're not Windows.
http://www.theregister.co.uk/content/55/36029.html


  • Prev by Date: Re: Problem with animate
  • Next by Date: Re: webMathematica question
  • Previous by thread: Re: Scientific Notation in ListPlot Axes
  • Next by thread: Re: All combinations