GCD Extreme II
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
For a given calculate the value of , where
Here means the greatest common divisor of integers and .
For those who have trouble understanding summation notation, the meaning of is given in the following code:
g = 0; for (i = 1; i < n; i++) for (j = i + 1; j <= n; j++) g += gcd(i, j);
Input
Consists of no more than lines. Each line contains one integer . Input is terminated by a line containing a single zero and should not be processed.
Output
For each input number print in a separate line the corresponding value of . The value of fits in a -bit signed integer.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 39%