Given the value of N, you will have to find the value of G. The definition of G isgivenbelow:
>G=∑i=1n−1∑j=i+1NGCD(i,j)>
Here GCD(i, j) means the greatest common divisor ofinteger i andinteger j.
For those who have trouble understanding summation notation, the meaning of G isgiveninthe following code:
G=0;
for(i=1;i<N;i++)
for(j=i+1;j<=N;j++)
{
G+=gcd(i,j);
}
/*Here gcd() is a function that findsthe greatest common divisor ofthe two input
numbers*/
【Input】
The input file containsat most 100linesof inputs. Each linecontainsaninteger N
(1 < N < 4000001).
The meaning of N is given inthe problem statement. Input is terminated byaline
containing a single zero.
【Output】
For eachlineof input produce onelineof output. This linecontainsthevalueof
G forthe corresponding
N. The valueof G will fit ina64-bit signed integer.