#P1712E1. LCM Sum (easy version)

    ID: 8101 远端评测题 3000ms 512MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>binary searchbrute forcecombinatoricsmathnumber theorytwo pointers

LCM Sum (easy version)

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 $t$. You can make hacks only if both versions of the problem are solved.

You are given two positive integers $l$ and $r$.

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

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

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

The only line for each test case contains two integers $l$ and $r$ ($1 \le l \le r \le 2 \cdot 10^5$, $l + 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 $t$ ($\bf{1 \le t \le 5}$). Description of the test cases follows.

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

Output

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

Samples

<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>
3
1
78975
969
109229059713337

Note

In the first test case, there are $3$ suitable triplets:

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

In the second test case, there is $1$ suitable triplet:

  • $(3,4,5)$.