You are given two positive integers \(L\) and \(R\). Find the number of integers in the range \([L,\ R]\) that can be represented as the difference of two squares. In other words, find the number of integers \(X\) in the range \([L,\ R]\) such that \(X = P^2 - Q^2\) where \(P\) and \(R\) are integers.
Input format
- The first line contains \(T\) denoting the number of test cases.
- Each of the next \(T\) lines contain two integers \(L\) and \(R\)..
Output format
For each test case, you are required to print exactly \(T\) lines each containing only 1 positive integer.
Constraints
Numbers in the Range [1,5] which can be written as the difference of two squares are : 1,3,4,5. Hence, the answer is 4.
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
Login to unlock the editorial
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