Counting Pairs Problem Statement

Given a positive integer N, determine the count of all possible positive integral pairs (X, Y) that satisfy the equation 1/X + 1/Y = 1/N.

Example:

Input:
T = 1
N = 2
Output:
3
Explanation:

The solutions for 1/X + 1/Y = 1/2 are (3, 6), (6, 3), (4, 4). Total count is 3.

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 104
  • Time Limit: 1 sec.
Input Format:
The first line contains an integer 'T' which represents the number of test cases.
Each test case consists of a single positive integer 'N'.
Output Format:
Each test case output should be an integer denoting the count of the pairs satisfying the equation.
Print the result for each test case on a new line.
Note:
Implement the function to determine the count of pairs. No need to handle input/output formatting manually.
Be the first one to answer
Add answer anonymously...
Goldman Sachs Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter