Cody

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_0 = 0 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

72.53% Correct | 27.47% Incorrect
Last solution submitted on Aug 26, 2016

Problem Comments

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!

Join the 15-year community celebration.

Play games and win prizes!

Learn more