#P1712E1. LCM Sum (easy version)

    ID: 7850 Type: RemoteJudge 3000ms 512MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>binary searchcombinatoricsmathnumber theorytwo pointers

LCM Sum (easy version)

No submission language available for this problem.

Description

We are sum for we are many
Some Number

This version of the problem differs from the next one only in the constraint on tt. You can make hacks only if both versions of the problem are solved.

You are given two positive integers ll and rr.

Count the number of distinct triplets of integers (i,j,k)(i, j, k) such that li<j<krl \le i < j < k \le r and lcm(i,j,k)i+j+k\operatorname{lcm}(i,j,k) \ge i + j + k.

Here lcm(i,j,k)\operatorname{lcm}(i, j, k) denotes the least common multiple (LCM) of integers ii, jj, and kk.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5\bf{1 \le t \le 5}). Description of the test cases follows.

The only line for each test case contains two integers ll and rr (1lr21051 \le l \le r \le 2 \cdot 10^5, l+2rl + 2 \le r).

For each test case print one integer — the number of suitable triplets.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t5\bf{1 \le t \le 5}). Description of the test cases follows.

The only line for each test case contains two integers ll and rr (1lr21051 \le l \le r \le 2 \cdot 10^5, l+2rl + 2 \le r).

Output

For each test case print one integer — the number of suitable triplets.

Samples

Sample Input 1

<div class="test-example-line test-example-line-even test-example-line-0">5</div><div class="test-example-line test-example-line-odd test-example-line-1">1 4</div><div class="test-example-line test-example-line-even test-example-line-2">3 5</div><div class="test-example-line test-example-line-odd test-example-line-3">8 86</div><div class="test-example-line test-example-line-even test-example-line-4">68 86</div><div class="test-example-line test-example-line-odd test-example-line-5">6 86868</div><div class="test-example-line test-example-line-odd test-example-line-5"></div>

Sample Output 1

3
1
78975
969
109229059713337

Note

In the first test case, there are 33 suitable triplets:

  • (1,2,3)(1,2,3),
  • (1,3,4)(1,3,4),
  • (2,3,4)(2,3,4).

In the second test case, there is 11 suitable triplet:

  • (3,4,5)(3,4,5).