LCMSUM  LCM Sum
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
Constraints
1 <= T <= 300000
1 <= n <= 1000000
hide comments
fetus:
20200708 09:09:38
∑LCM(i, n) = ((∑(d * ETF(d)) + 1) * n) / 2


priyankarai:
20200611 19:37:31
how to get rid of TLE. my time complexity is O(n log n +t*sqrt(n) ) 

abuhuraira071:
20200423 20:34:22
lcm(factor of n,n)=n; 

zakir_1999:
20200203 19:59:52
I got Tl useing sieve function.what can I do at now??


alexardelean:
20200112 15:49:47
Ac in one go. Found the problem by seeing the solution lmao 

shammya:
20191123 17:21:06
1.use printf scanf for I/O to avoid TLE


kamesh11:
20190910 15:41:34
Very nice problem. Took me almost 45 hours to eliminate that TLE...huh! 

sid779:
20190701 19:17:11
AC in one go but I looked for the proof on google as I can't think of a solution :( 

whyamievenhere:
20181220 17:28:09
Again man useless time limits, how the heck are we supposed to find divisors of a number range without sieve?? 

DK...:
20180830 18:43:29
i got TL using pragma's, but AC without them...

Added by:  Varun Jalan 
Date:  20100124 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: PERL6 
Resource:  own problem used for Codechef Snackdown Onsite 