Submit | All submissions | Best solutions | Back to list |
PCOPTRIP - Counting Pairwise Coprime Triples |
A tuple of three numbers (, , ) is called a pairwise coprime triple if , , and .
Let be the number of pairwise coprime triples which satisfy .
For example, = #{(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 3), (1, 3, 1), (1, 3, 2), (2, 1, 1), (2, 1, 3), (2, 3, 1), (3, 1, 1), (3, 1, 2), (3, 2, 1)} = 13.
Given , find .
Input
First line contains (), the number of test cases.
Each line of the next lines contains a single integer ().
It is guaranteed that in each input file.
Output
For each number , output a single line containing .
Example
Input
5
1
2
3
10
100
Output
1
4
13
280
282814
Information
There are 5 input files.
My C++ solution runs in 3.04 sec. (in the worst case)
Added by: | Min_25 |
Date: | 2014-09-02 |
Time limit: | 8s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |