You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
Zeckendorf's theorem states that any positive integer, N, can be written as a sum of non-consecutive Fibonacci numbers uniquely. This is achieved by a greedy algorithm: the representation always starts with the largest Fibonacci number <= N.
Here, I used the definition of Fibonacci numbers as:
F(0) = 0
F(1) = 1
F(n) = F(n-1) + F(n-2).
For example: N = 100 = 89 + 8 + 3.
This code outputs the Zeckendorf representation of a positive integer N. Fibonacci numbers are computed using binary exponentiation of the Fibonacci matrix [1 1; 1 0].
Cite As
Karl Ezra Pilario (2026). zeckendorf(N) (https://www.mathworks.com/matlabcentral/fileexchange/67017-zeckendorf-n), MATLAB Central File Exchange. Retrieved .
General Information
- Version 1.1.0.0 (1.95 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux