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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news1.as3257.net!newsfeed1.eu.ignite.net!news.stupi.se!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From Dana DeLouis <dana01@icloud.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: List:{1}, {2,3},{4,5,6}....
Date Mon, 14 Jan 2013 05:01:12 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <kd03eo$6ds$1@smc.vnet.net> (permalink)
Lines 51
Organization Time-Warner Telecom
NNTP-Posting-Date 14 Jan 2013 05:04:04 GMT
NNTP-Posting-Host 5786f6fa.news.twtelecom.net
X-Trace DXC=k<Rie\BS?4;C=aIl6945`?C_A=>8kQj6=Y;@_o827nG3G`=2W4YiB59EFiONJ7[Go645Z[Z^<Z2d0
X-Complaints-To abuse@twtelecom.net
Xref csiph.com comp.soft-sys.math.mathematica:13136

Show key headers only | 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