Problem 232. Project Euler: Problem 2, Sum of even Fibonacci
Solution Stats
Problem Comments
-
5 Comments
I wanted to use : z = feval(symengine,'numlib::fibonacci',10)
to get the 10th element for example but CODY returns:
Could not check out Symbolic Math Toolbox license.
pas de chance!
You should add test cases where x or x+1 equals an even fibonacci number (either small or large).
Nice problem. I always have problem with big numbers.
I solved the problem until x = 4000000 but x = 97455000 it gives me an error of exceeding the memory(overflow) because the number is too large.
This was fun!
Solution Comments
-
1 Comment
hay day em
-
1 Comment
푸어 솔루션
-
4 Comments
I only generate the even numbers.Its save my solution a lot of time.My solution bases on algolithrim
E(N) = 4 * E(N-1) + E(N-2)
where E(0) = 2 and E(1) = 8
You might wanna try again
Wow thank for advise I dont think x =2 make my loop not work.Your additional test case make me change.
Tran Tran, thanks for the tip. Your formula to to calculate just the even Fibonacci numbers really work. Thanks!
-
1 Comment
the last value x = 666576 the correct answer should be 574925
-
1 Comment
My solution works fine on my Laptop unter R2015b. Nevertheless i get the error:
While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore.
-
1 Comment
nice
-
1 Comment
Cheat!!!!!!!!!!
-
1 Comment
y is it not working when it even works on octave and get results in a sec
-
1 Comment
While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore.
those test numbers are too big
-
1 Comment
it is correct but by server error its not showing
-
2 Comments
test for cheating
CHEATER !!!!
-
2 Comments
OK, I gamed this one so it only works up to about 1 billion. I wanted to see everyone else's interesting solutions.
You can first generate the even fibonacci numbers for the given first two elements (here, 1 and 2) till they reach x, then sum the calculated even numbers (that are less than or equal to the input value x).
-
2 Comments
this trick (c.f. Solution 26456) works only for these particular test cases, it would fail for example with euler002(6)...
While evaluating the solution, the server encountered an error caused by temporary unavailability of MATLAB Service. Wait a few minutes for the MATLAB Service to return, and then rescore.
Problem Recent Solvers1710
Suggested Problems
-
991 Solvers
-
459 Solvers
-
Implement simple rotation cypher
1033 Solvers
-
648 Solvers
-
10448 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!