MathGroup Archive 1999

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

Search the Archive

Re: How to construct all possible orderings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15675] Re: [mg15588] How to construct all possible orderings
  • From: Robert Pratt <rpratt at math.unc.edu>
  • Date: Sat, 30 Jan 1999 04:29:06 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Flatten[Table[{i,j,k},{i,3},{j,3},{k,3}],2]/.{1->A,2->B,3->C}

will give you

{{A, A, A}, {A, A, B}, {A, A, C}, {A, B, A}, {A, B, B}, {A, B, C},

>    {A, C, A}, {A, C, B}, {A, C, C}, {B, A, A}, {B, A, B}, {B, A, C},

>    {B, B, A}, {B, B, B}, {B, B, C}, {B, C, A}, {B, C, B}, {B, C, C},

>    {C, A, A}, {C, A, B}, {C, A, C}, {C, B, A}, {C, B, B}, {C, B, C},

>    {C, C, A}, {C, C, B}, {C, C, C}}

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

http://www.math.unc.edu/Grads/rpratt/

On Thu, 28 Jan 1999, Carlos Carreto wrote:

> Hello,
> 
> I am trying to construct all possible orderings  of  for example 3
> elements, where each element can be A, B or C.
> 
> The result will be something like this: AAA
> AAB
> AAC
> ABA
> . . .
> CCC
> 
> How can I do this? 
> 
> Thank you.
> 
> -:- Carlos
> 
> 
> 
> 



  • Prev by Date: Re: Block vs. Module
  • Next by Date: Re: How to construct all possible orderings
  • Previous by thread: Re: How to construct all possible orderings
  • Next by thread: Re: How to construct all possible orderings