Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: generating subsets

  • To: mathgroup at
  • Subject: [mg21599] Re: [mg21588] generating subsets
  • From: Maris Tõnso <maris at>
  • Date: Sun, 16 Jan 2000 22:43:47 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at


I find the following function Subsets from Ilan Vardi's package

Subsets[x_]:= Distribute[{{}, {#}}& /@ x, List, List, List, Union]

Maris Tonso

Michael Gass wrote:

> I need an _efficient_  procedure for generating all the subsets
> of a given set.  The procedure should produce output as follows:
> subSets[{a,b,c}]
> produces
> {{}, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c}}
> I have written a recursive procedure to do this, but
> it takes quite a while to generate, say, the 512 subsets
> of a 9 element set and I need to work with somewhat larger
> sets.
> Thanks
> --
> Michael Gass                            Department of Mathematics
> phone: 320 363-3090                     St. John's University
> email: mgass at                 Collegeville, MN  56321-3000

  • Prev by Date: Series expansion of ArcSin around 1
  • Next by Date: Re: Plotting A verticle line?
  • Previous by thread: Re: generating subsets
  • Next by thread: Re: generating subsets