Problem 42340. Fibonacci Decomposition

Created by Ned Gulley in Community

Every positive integer has a unique decomposition into nonconsecutive Fibonacci numbers f1+f2+ ... Given a positive integer n, return these numbers.

Return the vector f = [f1, f2, ...] sorted from smallest to largest. sum(f) = n.


 n = 3
 f = 3
 n = 32
 f = [3 8 21]


Solution Stats

68.0% Correct | 32.0% Incorrect
Last solution submitted on Mar 10, 2019

Problem Comments

Recent Solvers22

Suggested Problems

More from this Author63


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!