Forgot password?
 Create new account
View 2652|Reply 3

列举数列的前100项

[Copy link]

87

Threads

2383

Posts

110K

Credits

Credits
13325

Show all posts

其妙 Posted at 2014-7-1 22:56:03 |Read mode
i = 1;
a[1] = 2;
a[2] = 6;
Do[{a[i + 2] = 2 a[i + 1] + a[i], i++}, {100}]
Table[a[n], {n, 1, 100}]
out:
{2, 6, 14, 34, 82, 198, 478, 1154, 2786, 6726, 16238, 39202, 94642, 228486, 551614, 1331714, 3215042, 7761798, 18738638, 45239074, 109216786, 263672646, 636562078, 1536796802, 3710155682, 8957108166,21624372014, 52205852194, 126036076402, 304278004998, 734592086398, 1773462177794, 4281516441986, 10336495061766, 24954506565518, 60245508192802, 145445522951122, 351136554095046, 847718631141214, ……
i = 1;
a[1] = 3;
a[2] = 9;
Do[{a[i + 2] = a[i + 1] + 2 a[i], i++}, {100}]
Table[a[n], {n, 1, 100}]
out:{3, 9, 15, 33, 63, 129, 255, 513, 1023, 2049, 4095, 8193, 16383, 32769, 65535, 131073, 262143, 524289, 1048575, 2097153, 4194303, 8388609, 16777215, 33554433, 67108863, 134217729, 268435455, 536870913, 1073741823, 2147483649, 4294967295, 8589934593, 17179869183, 34359738369, 68719476735, ……
妙不可言,不明其妙,不着一字,各释其妙!

462

Threads

969

Posts

9934

Credits

Credits
9934

Show all posts

青青子衿 Posted at 2014-7-2 20:03:50
回复 1# 其妙
可以试着用把字符变成代码(Mathematics代码)
  1. i = 1;
  2. a[1] = 2;
  3. a[2] = 6;
  4. Do[{a[i + 2] = 2 a[i + 1] + a[i], i++}, {100}]
  5. Table[a[n], {n, 1, 100}]
Copy the Code

87

Threads

2383

Posts

110K

Credits

Credits
13325

Show all posts

 Author| 其妙 Posted at 2014-7-7 22:08:21
回复 2# 青青子衿

一样的嘛

801

Threads

4889

Posts

310K

Credits

Credits
36169

Show all posts

isee Posted at 2017-10-12 14:29:32
这个也顶上来,哈哈,核心,Mathematica的核心。。。

手机版Mobile version|Leisure Math Forum

2025-4-20 22:13 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list