All Tracks Math Number Theory Problem

Alice and Pairs
Tag(s):

Easy-Medium, Math, Number Theory, Prime Factorization, Sieve

Problem
Editorial
Analytics

Alice is very good in mathematics. So, his teacher gave him a number $$N$$ and wants from him to count total number of pairs, such that $$gcd( x ,y )=1$$ and $$x*y=N$$, where $$(x, y)$$ forms a pair.

Alice is very busy in his exams and he wants your help .So solve this problem for Alice.

Input:
Input starts with a number $$T$$ and then follows $$T$$ lines contains a single number, $$N$$.

Output:
Find the total number of pairs, and print the required answer in a new line.

Constraints:
$$1 \le T \le 10^5$$
$$1 \le N \le 10^7$$

SAMPLE INPUT
2
2
6
SAMPLE OUTPUT
2
4
Explanation

For 1st test case, pairs are (1,2) and (2,1)

For 2nd test case, pairs are (1,6) , (6,1) , (2,3) and (3,2).

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala 2.11.8, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Sapient Global Markets

Challenge Name

Sapient Global Markets Core Java Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications