Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #13110
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: List:{1}, {2,3},{4,5,6}.... |
| Date | 2013-01-12 03:23 +0000 |
| Message-ID | <kcql08$lr5$1@smc.vnet.net> (permalink) |
| References | <kcntv4$f8h$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
On Jan 10, 6: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.
I'm not sure what "better" means, but
here are the original and two others:
m = 5
Table[i+1,{n,m},{i,n(n-1)/2,n(n-1)/2+n-1}] (* original *)
Table[Range[1+n(n-1)/2,n(n+1)/2],{n,m}] (* clearest ? *)
Range[2+#*#-#,#*#+#,2]/2&/@Range@m (* shortest ? *)
5
{{1},{2,3},{4,5,6},{7,8,9,10},{11,12,13,14,15}}
{{1},{2,3},{4,5,6},{7,8,9,10},{11,12,13,14,15}}
{{1},{2,3},{4,5,6},{7,8,9,10},{11,12,13,14,15}}
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
List:{1}, {2,3},{4,5,6}.... hknetman <hknetman@hotmail.com> - 2013-01-11 02:38 +0000
Re: List:{1}, {2,3},{4,5,6}.... "Moses, Peter J. C." <mows@mopar.freeserve.co.uk> - 2013-01-12 03:22 +0000
Re: List:{1}, {2,3},{4,5,6}.... Ray Koopman <koopman@sfu.ca> - 2013-01-12 03:23 +0000
Re: List:{1}, {2,3},{4,5,6}.... Ray Koopman <koopman@sfu.ca> - 2013-01-12 03:24 +0000
csiph-web