Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13136

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

From Dana DeLouis <dana01@icloud.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: List:{1}, {2,3},{4,5,6}....
Date 2013-01-14 05:01 +0000
Message-ID <kd03eo$6ds$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: List:{1}, {2,3},{4,5,6}.... Dana DeLouis <dana01@icloud.com> - 2013-01-14 05:01 +0000

csiph-web