Factorial Pairs
Submissions: 109   Accuracy:

29.36%

  Difficulty: Easy   Marks: 2

Given Two integers L and R find the total number of distinct pairs (p,q)  between L and R ( both inclusive ) satisfying the given relationship.
p! * q!=k^2 (a perfect square)
where p,q,k is any integer and '!' denotes factorial.

 

Input
first line of input contains of an integer 'T' denoting number of test cases
Only line of each testcase contains two integers L and R .

 

Output:
for each case print an integer corresponding to the answer .


Constraints:
1<=T<=100
0<=L<=R<=10^18


Example:

Input:

2
0 1
1 3


Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Hardik Gulati
Author: hardikgulati96


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.