Coprime numbers
Practice
2.5 (4 votes)
Number theory
Implementation
Number theory
Integer factorization
Bitmask
Algorithms
Bit manipulation
Sieve
Math
Problem
88% Success 934 Attempts 50 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given the number \(N\).

Determine the number of pairs \(P,Q\) such that they satisfies the following conditions:

  • \(1 < P < Q, P \times Q ≤ N\)
  • Numbers \(P\) and \(Q\) are co-prime numbers

Note: Two integers \(a\) and \(b\) are called coprime, relatively prime, or mutually prime, if the only positive integer that is a divisor of both of these numbers is 1.

Input format

  • The first contains an integer \(T\) that denotes the number of test cases in the input.
  • The next \(T\) lines contain an integer \(N\).

Output format

Print \(T\) lines. The \(i^{th}\) line must contain the answer for the \(i^{th}\) test case.

Constraints

\(1≤T≤10\)

\(1≤N≤10^9\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:50
2 votes
Tags:
Prime FactorizationLCMMedium-HardMathematicsFactorization