Re: how to list all arrange of n! to a table
- To: mathgroup at smc.vnet.net
- Subject: [mg27718] Re: how to list all arrange of n! to a table
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Tue, 13 Mar 2001 03:52:37 -0500 (EST)
- References: <98ht0v$mnt@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
If the order is not importent: Permutations[Range[3]] {{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}} Or if single numbers are needed: ToExpression[StringJoin@@@Permutations[ToString/@Range[3]]] {123,132,213,231,312,321} If the order is importent xx=Take[Permutations[Range[3]]//Sort,3!/2] {{1,2,3},{1,3,2},{2,1,3}} Flatten[Transpose[{xx,Reverse/@xx}],1] {{1,2,3},{3,2,1},{1,3,2},{2,3,1},{2,1,3},{3,1,2}} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "zeno69" <zeno69 at pchome.com.tw> wrote in message news:98ht0v$mnt at smc.vnet.net... > if n = 3 then list > 123 > 321 > 132 > 231 > 213 > 312 > to access or excel > > > >