大菠萝

大菠萝-ama+sor

Sum even-valued terms in Fibonacci sequence

Project Euler 第二题

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

Find the sum of all the even-valued terms in the sequence which do not exceed four million.

斐波那契数列(Fibonacci sequence)出自意大利数学家Leonardo Fibonacci 1202年出版的《算盘全书》。数列的最初两个数都是1,其后每个数都是前两个数之和。

解答过程见sum-fibonacci-sequence-not-exceed-four-million.py

firstThink是我写的,相当垃圾,secondThink和thirdThink是参考帮助说明写的。

相关下载:


相关阅读

tags: ,,

Posted by benben on November 19,2008 12:05 PM in 程序设计 ||Comment(0)
0个脚印

留言




早起的鸟儿有虫子吃


e.g. "大菠萝"