Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: combinations of n objects 2 at a time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15178] Re: combinations of n objects 2 at a time
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 18 Dec 1998 23:20:22 -0500
  • References: <75cvud$3u8@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Albert,

Join@@Table[{i, j}, {i, 6}, {j, 1, i - 1}]

{{2, 1}, {3, 1}, {3, 2}, {4, 1}, {4, 2}, {4, 3}, {5, 1}, {5, 2}, {5, 3},
  {5, 4}, {6, 1}, {6, 2}, {6, 3}, {6, 4}, {6, 5}}

Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


Albert Maydeu-Olivares wrote in message <75cvud$3u8 at smc.vnet.net>...
Hello,

In order to generate all combinations of n objects 2 at a time I load
the `DiscreteMath` add-on.

<<DiscreteMath`Combinatorica`

l[n_]:=rt[Ksubsets[Reverse[Table[i,{i,n}]],2]]


So that with n=objects I get

l[6]

{{2,1},{3,1},...,{6,4},{6,5}}

Any suggestions on how to do this without loading the add-on?

--

Albert Maydeu-Olivares Tel. +34 3 4021079 ext. 3099 Faculty of
Psychology Fax. +34 3 4021362 University of Barcelona E-Mail:
amaydeu at tinet.fut.es Passeig de la Vall d'Hebron, 171. 08035 -
Barcelona (Spain)




  • Prev by Date: tab spacing
  • Next by Date: Including Mathematica notebooks in LaTeX
  • Previous by thread: Re: combinations of n objects 2 at a time
  • Next by thread: Re: combinations of n objects 2 at a time