Server Time: Thu Aug 6, 2020 9:52 am
 Welcome ( logout )
1375 - LCM Extreme
 PDF (English) Statistics Forum
 Time Limit: 4 second(s) Memory Limit: 64 MB

Find the result of the following code:

unsigned long long allPairLcm( int n ) {

unsigned long long res = 0;

for( int i = 1; i <= n; i++ )

for( int j = i + 1; j <= n; j++ )
res
+= lcm(i, j); // lcm means least common multiple

return res;
}

A straight forward implementation of the code may time out.

# Input

Input starts with an integer T (≤ 2*105), denoting the number of test cases.

Each case starts with a line containing an integer n (1 ≤ n ≤ 3*106).

# Output

For each case, print the value returned by the function 'allPairLcm(n)'. As the result can be large, we want the result modulo 264.

# Output for Sample Input

4

2

10

13

100000

Case 1: 2

Case 2: 1036

Case 3: 3111

Case 4: 9134672774499923824

# Note

Dataset is huge, use faster I/O Methods.

Problem Setter: Jane Alam Jan
Special Thanks: Derek Kisman, Tasnim Imran Sunny
 Developed and Maintained by JANE ALAM JAN Copyright © 2012 LightOJ, Jane Alam Jan