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 #135: Same differences

Project Euler #135: Same differences

Problem
Submissions
Leaderboard
Discussions

This problem is a programming version of Problem 135 from projecteuler.net

Given the positive integers, , , and , are consecutive terms of an arithmetic progression, the least value of the positive integer, , for which the equation, , has exactly two solutions is :

It turns out that is the least value which has exactly solutions.

Let be the number of solutions for this value of . For example, and .

Given , what is ?

Input Format

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

Each test case consists of one line containing a single integer, .

Constraints

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

In the next 5 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

2
27
1155

Sample Output

2
10

Author

kevinsogo

Difficulty

Medium

Max Score

100

Submitted By

622

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