Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: List:{1}, {2,3},{4,5,6}....
Replies: 2   Last Post: Jan 14, 2013 12:01 AM

 Messages: [ Previous | Next ]
 Dana DeLouis Posts: 24 Registered: 11/18/12
Re: List:{1}, {2,3},{4,5,6}....
Posted: Jan 14, 2013 12:01 AM

> 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...@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}....

Date Subject Author
1/11/13 Bob Hanlon
1/14/13 Dana DeLouis