Problem 1946. Fibonacci-Sum of Squares
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
		    Show
		    1 older comment
		  
		  
		goc3
    	on 23 May 2017
	
	
  	Additional test cases have been added.
		Yingcong Zhou
    	on 24 Dec 2017
	
	
  	There is a typo in the question. F_0 = 0 should be F_0 = 1 otherwise the tests will not be passed.
		Maryam HCTRAK Yousef
    	on 14 Aug 2020
	
	
  	It shows me wrong!
		Siddhesh
    	on 18 Apr 2025
	
	
  	This helps me
Solution Comments
Show commentsProblem Recent Solvers1523
Suggested Problems
- 
         Find the sum of all the numbers of the input vector 52611 Solvers 
- 
         
         1697 Solvers 
- 
         
         608 Solvers 
- 
         find the surface area of a cube 552 Solvers 
- 
         
         647 Solvers 
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!