MathGroup Archive 2010

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

Search the Archive

Adding the elements of a list sequentially

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109327] Adding the elements of a list sequentially
  • From: ebaugh at illinois.edu
  • Date: Thu, 22 Apr 2010 03:29:59 -0400 (EDT)

I am looking for an efficient way to add the elements of a list 
sequentially onto another list

For example, generate list c, given lists a and b:

a = {1,2,3,4,5,6,7,8,9,10}
b = {1,2}

c = {2,4,4,5,6,7,8,9,10,11}


another example:

a = {1,1,1,1,1}
b = {1,2,3}

c = {2,3,4,2,3}

It seems like there must be a built in function to do this, but 
have been unable to find it.


Thanks a 10^6
Jason Ebaugh


  • Prev by Date: Find (cyclic) Sequence
  • Next by Date: Imposing constraints on a system of equations
  • Previous by thread: Re: Find (cyclic) Sequence
  • Next by thread: Re: Adding the elements of a list sequentially