果然不是很难,今天上午把公牛母牛的事想复杂了。代码我觉得都不用我写了,我算了前 50 项(不知道为什么非要用递归,这个纯用递归慢的一塌糊涂。):
括号里的是前一项和后一项的差(换句话说,当前项加上那个括号里的数是下一项),括号里的就是 fibonacci 数列。
之前给的表对错行了,现在修正了。
[ 本帖最后由 pangding 于 2011-3-29 22:43 编辑 ]
括号里的是前一项和后一项的差(换句话说,当前项加上那个括号里的数是下一项),括号里的就是 fibonacci 数列。
1 [0]
1 [0]
1 [1]
2 [1]
3 [1]
4 [2]
6 [2]
8 [3]
11 [3]
14 [5]
19 [5]
24 [8]
32 [8]
40 [13]
53 [13]
66 [21]
87 [21]
108 [34]
142 [34]
176 [55]
231 [55]
286 [89]
375 [89]
464 [144]
608 [144]
752 [233]
985 [233]
1218 [377]
1595 [377]
1972 [610]
2582 [610]
3192 [987]
4179 [987]
5166 [1597]
6763 [1597]
8360 [2584]
10944 [2584]
13528 [4181]
17709 [4181]
21890 [6765]
28655 [6765]
35420 [10946]
46366 [10946]
57312 [17711]
75023 [17711]
92734 [28657]
121391 [28657]
150048 [46368]
196416
1 [0]
1 [1]
2 [1]
3 [1]
4 [2]
6 [2]
8 [3]
11 [3]
14 [5]
19 [5]
24 [8]
32 [8]
40 [13]
53 [13]
66 [21]
87 [21]
108 [34]
142 [34]
176 [55]
231 [55]
286 [89]
375 [89]
464 [144]
608 [144]
752 [233]
985 [233]
1218 [377]
1595 [377]
1972 [610]
2582 [610]
3192 [987]
4179 [987]
5166 [1597]
6763 [1597]
8360 [2584]
10944 [2584]
13528 [4181]
17709 [4181]
21890 [6765]
28655 [6765]
35420 [10946]
46366 [10946]
57312 [17711]
75023 [17711]
92734 [28657]
121391 [28657]
150048 [46368]
196416
之前给的表对错行了,现在修正了。
[ 本帖最后由 pangding 于 2011-3-29 22:43 编辑 ]