Weird GCD Value

 You are given two positive integers 

a and b, we define f(a,b) as the maximum value of |gcd(a,x)gcd(b,x)| where x is some natural number. Formally,

f(a,b)=maxxN|gcd(a,x)gcd(b,x)|

, where N represents the set of natural numbers and gcd(a,b) represents the greatest common divisor of a and b.

You are given an integer k. You need to find the number of ordered pairs (a,b) (where a,b are positive) such that f(a,b)=k.

Note that pairs (a,b) and (b,a) are considered different if ab. For example, pair (1,2) is not the same as (2,1).

Input Format

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each testcase contains a single integer k.

Output Format

For each testcase, output the number of ordered pairs (a,b) such that f(a,b)=k.

Constraints

  • 1T106
  • 1k106

Sample Input 1 

2
1
3

Sample Output 1 

2
6

Explanation

Test case 1: For k=1, we see that f(1,2)=f(2,1)=1. Therefore the answer is 2. It can be verified that there are no other pairs for which the f value is 1.

Test case 2: For k=3, there exists 6 ordered pairs for which the f value is 3. One of them is (4,3).

Previous
Next Post »