Problem 44311. Number of Even Elements in Fibonacci Sequence
Find how many even Fibonacci numbers are available in the first d numbers.
Consider the following first 14 numbers
1 1 2 3 5 8 13 21 34 55 89 144 233 377 ...
4 of them are even.
Solution Stats
Problem Comments
-
8 Comments
Big number is a problem. Instead we can find the regular pattern in which those even and odd numbers appear. Then everything becomes simple and easy.
Gorgeously simple once you figure it out
hint: copy and paste the first few test suites into your MATLAB console and try plotting it with ':o'
My solution is working in my local computer but is not consistent with Test Suites starting from d = 100. I don't still get the answer.
You dont need generate all d fibonacci number to find the numbers of even.Think like that 2 odd fibonacci numbers will make a even number
like 1 1 make 2, and 3 5 make 8.So 3 numbers in group will have a even number
Not a hard problem at all lol
The Tran Tran comment is the key to solve the problem.
interesting - I never noticed the groups of 3
Funny problem lol
Solution Comments
Show commentsProblem Recent Solvers1631
Suggested Problems
-
22500 Solvers
-
Back to basics 8 - Matrix Diagonals
960 Solvers
-
Implement simple rotation cypher
1092 Solvers
-
Getting the indices from a matrix
713 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
882 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!