Given the Fibonacci sequence defined by the following recursive relation,
- F(n) = F(n-1) + F(n-2)
- where F(1) = 1 and F(1) = 1
determine the sum of squares for the first "n" terms.
For example, n=5 --> 1^2 + 1^2 + 2^2 + 3^2 + 5^2 = 40.
- INPUT n=5
- OUTPUT S=40
Solution Stats
Problem Comments
4 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers1715
Suggested Problems
-
middleAsColumn: Return all but first and last element as a column vector
647 Solvers
-
Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]
399 Solvers
-
Matlab Basics - Absolute Value
671 Solvers
-
Number of Even Elements in Fibonacci Sequence
1640 Solvers
-
9366 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Additional test cases have been added.
There is a typo in the question. F_0 = 0 should be F_0 = 1 otherwise the tests will not be passed.
It shows me wrong!
This helps me