题目链接:https://www.spoj.pl/problems/LCMSUM/
SPOJ Problem Set (classical)
5971. LCM Sum
Problem code: LCMSUM
Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple of the integers i and n.
Input
The first line contains T the number of test cases. Each of the next T lines contain an integer n.
Output
Output T lines, one for each test case, containing the required sum.
Example
Sample Input :
3
1
2
5
Sample Output :
1
4
55
Const......
阅读全文