MathGroup Archive 2004

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

Search the Archive

Re: Combinations

  • To: mathgroup at
  • Subject: [mg49708] Re: [mg49672] Combinations
  • From: Ken Levasseur <klevasseur at>
  • Date: Thu, 29 Jul 2004 07:43:25 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at


If data is the output from the Outer expression,

Flatten[Map[StringJoin, Map[ToString, data, {4}], {3}]]


{"aaa", "aab", "aac", "aba", "abb", "abc", "aca", "acb",
   "acc", "baa", "bab", "bac", "bba", "bbb", "bbc", "bca",
   "bcb", "bcc", "caa", "cab", "cac", "cba", "cbb", "cbc",
   "cca", "ccb", "ccc"}

Ken Levasseur
Math. Sci.
UMass Lowell

On Jul 27, 2004, at 7:00 AM, Gregory Lypny wrote:

> Hello everyone,
> Does Mathematica have a built-in function that will generate a simple
> list all possible combinations of a list of strings?  For example,
> {a,b,c}, where the elements are strings, should give 3x3=27 triplets of
> "aaa", "aba", etc.
> I tried
> In[4]:=Outer[{a,b,c},{a,b,c},{a,b,c}]
> but I get
> {{{a, b, c}[a, a], {a, b, c}[a, b], {
>      a, b, c}[a, c]}, {{a, b, c}[b, a], {a, b, c}[b, b], {a, b,
>        c}[b, c]}, {{a, b, c}[c, a], {a, b, c}[c, b], {a, b, c}[c, c]}}
> which is going to be difficult to match with my data using BinCounts
> and the like.
> 	Regards,
> 		Greg

  • References:
    • Combinations
      • From: Gregory Lypny <>
  • Prev by Date: Re: Combinations
  • Next by Date: RE: Using "Sum" (i = 1 ... N) in a function definition
  • Previous by thread: Re: Combinations
  • Next by thread: Re: Combinations