Problem 52968. Easy Sequences 43: Least Common Fibonacci Number
The Fibonacci sequence F is a series whose elements are numbers starting with and , and subsequent Fibonacci numbers are defined recursively: . The first 20 Fibonacci numbers are:
Given two indices n and m, write a program to return the least common Fibonacci number, , which is defined as the smallest Fibonacci number divisible by both and . For example,, which is , since and both divide .
Since. the value of may become large even if the values of n and m are relatively small, please output a vector containing the number of digits and the last 6 digits of . Therefore, in the example above the output of , which has 4 digits, should be .
Solution Stats
Problem Comments
-
2 Comments
GeeTwo
on 7 Dec 2022
That's not really a standard way to number F(n), (usually F(0):==0 and F(1):==1) but OK...
James
on 2 Jun 2023
It's numbered like that because the lowest Fibonacci number divisible by F(a) and F(b) in the normal numbering system is F(lcm(a,b)). In the example here, you need to add one to everything to get that to work: lcm((3+1),(4+1)) = (19+1)
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
Remove any row in which a NaN appears
8477 Solvers
-
All your base are belong to us
529 Solvers
-
Project Euler: Problem 3, Largest prime factor
1350 Solvers
-
Matrix with different incremental runs
122 Solvers
-
843 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!