top of page

CO Prime (Asked in National Competence Evaluation Test 2020)

Writer's picture: Lokendra VedLokendra Ved

Calculate the number of pair of divisors of a number that are co prime.

Input Format

First line contains the number of test cases T.

Second line contains the number N.


Constraints

1<=N<=10^6

1<=T<=T^6


Output Format

For each test case print the number of pairs in a new line.


Sample Input

1

6


Sample Output

4


Explaination:

Calculate factors of 6 i.e. 1,2,3

Now we have to find the co prime factors. A Co Prime factor is tuple with HCF 1.

So (1,2), (1,3), (2,3), (1,2,3).


To get this combinations we will use itertools combinations.


Try it yourself and find the solution below.


Solution:



Follow Programmers Door for more.

54 views0 comments

Recent Posts

See All

Comments


bottom of page