Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: All combinations

  • To: mathgroup at
  • Subject: [mg47373] Re: [mg47357] All combinations
  • From: Andrzej Kozlowski <akoz at>
  • Date: Wed, 7 Apr 2004 03:16:31 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

On 6 Apr 2004, at 19:36, János wrote:

> 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.

There is no build in function but:


dos the trick, e.g:



Andrzej Kozlowski
Chiba, Japan

  • Prev by Date: Comparison of Mathematica on Various Computers
  • Next by Date: Re: Scientific Notation in ListPlot Axes
  • Previous by thread: All combinations
  • Next by thread: Re: All combinations