Counting Multiples by Divisor Count
Time limit1sMemory limit512 MB
Given N up to 10^18, count positive integers X that are multiples of N and have exactly N divisors, or report infinitely many.
- Level
Hard9 of 10
- Topics
- Number theory, Combinatorics, Math, Backtracking
- Solved
- No attempts yet
Problem
You are given a positive integer N. Count how many positive integers X satisfy both conditions below.
Xis a multiple ofN.- The number of positive divisors of
Xis exactlyN.
Input
The first line contains the number of test cases T. Each of the next T lines contains one positive integer N.
Output
For each test case, print the number of positive integers X that satisfy the conditions. If infinitely many such integers exist, print -1.
Constraints
1 ≤ T ≤ 1001 ≤ N ≤ 10^18
Hint
In the first case, 12 and 18 satisfy the conditions. In the second case, 113^112 satisfies the conditions.