Mozart Numbers
Practice
4 (1 votes)
Mathematics
Medium
Open
Approved
Problem
87% Success 133 Attempts 30 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Let us look at the close relative of Fibonacci numbers, called the Phibonacci numbers. They work exactly like Fibonacci numbers. F (1) = 0, F(1) = 1, F(2) = 1, and then F (n) = F ( n - 1 ) + F ( n - 2 ). In number theory, the nth Pisano period, written as ? (n), is the period with which the sequence of Fibonacci numbers, modulo n repeats.

Anyway. The question is extremely simple: you're given two integers A, and B - you've to find out the sum of all the such Phibonacci numbers in the given range A and B which have no new prime divisor that does not divide any earlier Phibonacci number. For clarity and for the sake of ease, 1 is NOT considered as such a number.

Input format:
The first line contains the number of test cases. Followed by two integers A and B. Both A and B are inclusive.

Input format:
You've to print the sum of all such required numbers modulo 109 + 7.

Constraints:
1 <= Test Cases <= 103
1 <= B <= 10 6
1 <= A < B

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Points:30
9 votes
Tags:
MediumAlgorithms
Points:30
2 votes
Tags:
MediumPrime FactorizationMathematicsOpenApprovedFactorization