Given two numbers M and N, the task is to check if the M-th and N-th Fibonacci numbers perfectly divide each other or not.
Input: M = 3, N = 6
F(3) = 2, F(6) = 8 and F(6) % F(3) = 0
Input: M = 2, N = 9
A naive approach will be to find the N-th and M-th Fibonacci numbers and check if they are perfectly divisible or not.
An efficient approach is to use the Fibonacci property to determine the result. If m perfectly divides n, then Fm also perfectly divides Fn, else it does not.
Exception: When N is 2, it is always possible as Fibo2 is 1, which divides every other Fibonacci number.
Below is the implementation of the above approach:
Time Complexity: O(1).
- An efficient way to check whether n-th Fibonacci number is multiple of 10
- How to check if a given number is Fibonacci number?
- Number of ways to represent a number as sum of k fibonacci numbers
- Finding number of digits in n'th Fibonacci number
- Nth Even Fibonacci Number
- Fibonacci number in an array
- Count the nodes whose sum with X is a Fibonacci number
- n'th multiple of a number in Fibonacci Series
- Python Program for n-th Fibonacci number
- C/C++ Program for nth multiple of a number in Fibonacci Series
- Distinct pairs from given arrays (a[i], b[j]) such that (a[i] + b[j]) is a Fibonacci number
- Find nth Fibonacci number using Golden ratio
- Program to find last two digits of Nth Fibonacci number
- Find Index of given fibonacci number in constant time
- Space efficient iterative method to Fibonacci number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.