Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Q: extract all k-tuple from a list of n elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49650] Q: extract all k-tuple from a list of n elements
  • From: Klaus Duellmann <klaus.duellmann at arcor.de>
  • Date: Mon, 26 Jul 2004 04:01:54 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Question: How can I extract all k-tuple from a list of n elements 
(without considering permutations of the k-tuple)?

Example: For the special case k=3 one solution would be

Flatten[Table[{i, j, k}, {i, 1, n - 2}, {j, i + 1, n - 1}, {k, j + 1, 
n}], 2];

A generalization of this solution for all k >=1 would involve to create 
'automatically' a table of dimension k, but how can this be implemented?

Any help is appreciated.

Regards,

Klaus


  • Prev by Date: Re: If-statement problems
  • Next by Date: Re: Re: 3D Pascal's Triangle (Cone?)
  • Previous by thread: RE: Long function defintions
  • Next by thread: Re: Q: extract all k-tuple from a list of n elements