MathGroup Archive 2004

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

Search the Archive

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


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