- All Contests
- ProjectEuler+
- Project Euler #136: Singleton difference

# Project Euler #136: Singleton difference

# Project Euler #136: Singleton difference

_{This problem is a programming version of Problem 136 from projecteuler.net}

The positive integers, , , and , are consecutive terms of an arithmetic progression. Given that is a positive integer, the equation, , has exactly one solution when :

In fact there are twenty-five values of below one hundred for which the equation has a unique solution.

How many values of in the range have exactly one solution?

**Input Format**

The first line of input contains , the number of test cases.

Each test case consists of one line containing two integers, and .

**Constraints**

In the first few test cases (worth 50% of the total points):

In the last few test cases (worth 50% of the total points):

**Output Format**

For each test case, output one line containing a single integer, the answer for that test case.

**Sample Input**

```
1
1 99
```

**Sample Output**

```
25
```