Re: How to create such a list
- To: mathgroup at smc.vnet.net
- Subject: [mg118475] Re: How to create such a list
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 29 Apr 2011 07:32:11 -0400 (EDT)
n = 5; Total /@ Subsets[Array[w, n]] {0, w[1], w[2], w[3], w[4], w[5], w[1] + w[2], w[1] + w[3], w[1] + w[4], w[1] + w[5], w[2] + w[3], w[2] + w[4], w[2] + w[5], w[3] + w[4], w[3] + w[5], w[4] + w[5], w[1] + w[2] + w[3], w[1] + w[2] + w[4], w[1] + w[2] + w[5], w[1] + w[3] + w[4], w[1] + w[3] + w[5], w[1] + w[4] + w[5], w[2] + w[3] + w[4], w[2] + w[3] + w[5], w[2] + w[4] + w[5], w[3] + w[4] + w[5], w[1] + w[2] + w[3] + w[4], w[1] + w[2] + w[3] + w[5], w[1] + w[2] + w[4] + w[5], w[1] + w[3] + w[4] + w[5], w[2] + w[3] + w[4] + w[5], w[1] + w[2] + w[3] + w[4] + w[5]} Bobby On Thu, 28 Apr 2011 05:37:16 -0500, Dominic Woerner <dominic.woerner at mpi-hd.mpg.de> wrote: > Hi, > > I like to create a list of the form: > 0,w[1],...,w[n],w[1]+w[2],...,w[1]+w[n],w[2]+w[3],......,w[1]+...+w[n] > for arbitrary n > Is there a neat way to do this? > > Cheers, > Dominic > -- DrMajorBob at yahoo.com