Re: Question
- To: mathgroup at smc.vnet.net
- Subject: [mg28089] Re: Question
- From: Matthias Hertel <wir95cgu at studserv.uni-leipzig.de>
- Date: Fri, 30 Mar 2001 04:12:41 -0500 (EST)
- References: <200103272035.PAA23800@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Per,
L1 = FoldList[Plus, 0, Range[4, 2, -1]]
L2 = FoldList[Plus, 0, Range[5, 2, -1]]
L3 = FoldList[Plus, 0, Range[6, 2, -1]]
or, in the template you gave, replace ? with
Sum[k, {k, n - i + 2, n}]
In[1]:= n=6;
In[2]:= Table[Sum[k, {k, n - i + 2, n}], {i, 1, n, 1}]
Out[2]= {0, 6, 11, 15, 18, 20}
But to me, this looks much more obfuscated than the version using
FoldList.
Regards
Matthias
"Per Lundgren" <yesgoyes at ebox.tninet.se> writes:
> "Hello,
> I am looking for the formula to create the following sets L1, L2 and L3 of
> numbers using
> Sum or Table and following the principle
> Table[?,{i,1,n,1}] n=4,5,6
>
> Thanks in advance. Per Lundgren, Sweden
> yesgoyes at ebox.tninet.se
> :";
>
> L1 = {0, 4, 7, 9}
> L2 = {0, 5, 9, 12, 14}
> L3 = {0, 6, 11, 15, 18, 20}