xule

Make progress everything
On the long way to full-stack developer, architecture

Blog Categories GitHub About

11 Oct 2014
FibonacciIsVeryLarge

Write an algorithm to calculate the sum of the even position in a fibonacci sequence ( the first 1000 fibonacci)

Comment: On site, I just use int to store fibonacci number,but …fibonacci is so large,int can store maybe no more then 40 fibonacci, coding is important.

Use int to store fibonacci can just store no more then maybe 40 it seems.

1   1   2  3  5  8  13  21  34  55  89  144  
233  377  610  987  1597  2584  4181  6765  10946  17711  
28657  46368  75025  121393  196418  317811  514229  832040  1346269  2178309  
3524578  5702887  9227465  14930352  24157817  39088169  63245986  102334155  165580141  267914296  
433494437  701408733  1134903170  1836311903  -1323752223  512559680  -811192543  -298632863  -1109825406  -1408458269  
1776683621  368225352  2144908973  -1781832971  363076002  -1418756969  -1055680967  1820529360  764848393  -1709589543  
-944741150  1640636603  695895453  -1958435240  -1262539787  1073992269  -188547518  885444751  696897233  1582341984   

scribble

乐此不疲~

2014-10-11 13:31:11


xule

scribble

Blog Categories GitHub About