Input: N = 12
1, 2 and 3 are the 3 divisors of 12 which are in the Fibonacci series.
Hence, the answer is 3.
Input: N = 110
1, 2, 5 and 55 are 4 divisors of 110 which are in the Fibonacci series.
- Create a hash table to store all the Fibonacci numbers till N, for checking in O(1) time.
- Find all divisors of N in O(∛N)
- For each divisor, check if it is a Fibonacci number as well. Count the number of such divisors and print them.
Below is the implementation of the above approach:
Time Complexity: O(∛N)
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Count of the non-prime divisors of a given number
- Count all perfect divisors of a number
- Count all pairs of divisors of a number N whose sum is coprime with N
- Count the numbers < N which have equal number of divisors as K
- Count number of integers less than or equal to N which has exactly 9 divisors
- Count of square free divisors of a given number
- Check if count of even divisors of N is equal to count of odd divisors
- Count elements in the given range which have maximum number of divisors
- Program to find count of numbers having odd number of divisors in given range
- Count of elements having odd number of divisors in index range [L, R] for Q queries
- Count nodes in the given tree whose weight is a fibonacci number
- Array range queries to count the number of Fibonacci numbers with updates
- Find sum of divisors of all the divisors of a natural number
- Find sum of inverse of the divisors when sum of divisors and the number is given
- Check if sum of Fibonacci elements in an Array is a Fibonacci number or not
- Check if a M-th fibonacci number divides N-th fibonacci number
- Count of numbers whose difference with Fibonacci count upto them is atleast K
- Count Divisors of n in O(n^1/3)
- Check if count of divisors is even or odd
- Count Divisors of Factorial
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.