斐波那契數列中的每一項被定義為前兩項之和。從1和2開始,斐波那契數列的前十項為:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
考慮斐波那契數列中數值不超過4百萬的項,找出這些項中值為偶數的項之和。
源**
stdmethodimp coula::test2(int imaxnumber)
//printf("%d\n",ifinalnumber);//printf number for test.
ifirstnumber = isecondnumber;
isecondnumber = ifinalnumber;
ifinalnumber = ifirstnumber + isecondnumber;
} printf("the test 2 sum is %d.\n",isumnunber);
return s_ok;
}
函式呼叫
#define test2_number 4000000
ioula->test2(test2_number);
輸出
the test 2 sum is 4613732.
尤拉計畫36題
double base palindromes problem 36 the decimal number,585 10010010012 binary is palindromic in both bases.find the sum of all numbers,less than one mi...
尤拉計畫 第二十四題
a permutation is an ordered arrangement of objects.for example,3124 is one possible permutation of the digits 1,2,3 and 4.if all of the permutations a...
尤拉計畫第3題
problem 3 the prime factors of 13195 are 5,7,13 and 29.what is the largest prime factor of the number 600851475143.問題3 13195的質因數為5,7,13和 29。6008514751...