Problem 52379. Double Fibonacci
double_fibonacci takes two integers, each greater than one, as input arguments (it does not have to check the format of the input) and returns a two-dimensional array. If it is called likethis,
A = double_fibonacci(M,N), then A is an M-by-N array that has the Fibonacci series on its first row, has the same series in its first column, and for rows n = 2 to M , row n contains the Fibonacci numbers that begin with nth number in the series. Here is an example showing the output when the input integers are 6 and 9,
A = double_fibonacci(6,9):
A =
[1 1 2 3 5 8 13 21 34;
1 2 3 5 8 13 21 34 55;
2 3 5 8 13 21 34 55 89;
3 5 8 13 21 34 55 89 144;
5 8 13 21 34 55 89 144 233;
8 13 21 34 55 89 144 233 377]
The first row of A gives the first nine numbers in the Fibonacci series. The series
starts with two ones, and each subsequent number is equal to the sum of
the two numbers that precede it.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers23
Suggested Problems
-
Project Euler: Problem 2, Sum of even Fibonacci
2257 Solvers
-
389 Solvers
-
94 Solvers
-
4449 Solvers
-
Convert a vector of Integers into a matrix of binaries
78 Solvers
More from this Author2
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!