We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #136: Singleton difference

Project Euler #136: Singleton difference

Problem
Submissions
Leaderboard
Discussions

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

Author

kevinsogo

Difficulty

Hard

Max Score

100

Submitted By

187

Need Help?


View discussions
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy