MathGroup Archive 2013

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

Search the Archive

Re: List:{1}, {2,3},{4,5,6}....

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129438] Re: List:{1}, {2,3},{4,5,6}....
  • From: Dana DeLouis <dana01 at icloud.com>
  • Date: Mon, 14 Jan 2013 00:02:30 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

> to get the following result:
> {{1}, {2, 3}, {4, 5, 6}, {7, 8, 9, 10}, {11, 12, 13, 14, 15}}

Hi.  If you don't actually need to generate a large list, here's another interesting idea:

Series[(-1-2 (-1+x) x)/(-1+x)^3,{x,0,10}]  //Normal

1+x+2 x^2+4 x^3+7 x^4+11 x^5+16 x^6+22 x^7+29 x^8+37 x^9+46 x^10

If you just need the fifth item in the list, then with 11 x^5, 
that list starts with 11, and has a length of 5.
ie.   {11, 12, 13, 14, 15}

Another variation might be just the list of starting values, with the length based on it's position.

z=CoefficientList[Series[(-1+x-x^2)/(-1+x)^3,{x,0,10}],x]

{1,2,4,7,11,16,22,29,37,46,56}

(ie 6th item starts with 16, and has length 6.  ie    16=8521)


The 1000th item starts with 499501.

Coefficient[Series[(-1-2 (-1+x) x)/(-1+x)^3,{x,0,1000}],x,1000] // Timing

{0.004363, 499501}

Just thought it interesting:

= = = = = = = = = =
HTH  :>)
Dana DeLouis
Mac & Mathematica 8
= = = = = = = = = =





On Jan 10, 9:38 pm, hknetman <hknet... at hotmail.com> wrote:
> I use the command
> list = Table[i + 1, {n, 1, 5}, {i, n (n - 1)/2, n (n - 1)/2 + n - 1}]
> to get the following result:
> {{1}, {2, 3}, {4, 5, 6}, {7, 8, 9, 10}, {11, 12, 13, 14, 15}}
>
> Is there any better method?
>
> Thanks a lot.

Re: List:{1}, {2,3},{4,5,6}....


  • Prev by Date: Re: Mathematica and Lisp
  • Next by Date: Re: wrong result when computing a definite integral
  • Previous by thread: Re: List:{1}, {2,3},{4,5,6}....
  • Next by thread: Dynamically updated CurrentValue: I want to know which key is being pressed?