Summation of gcd of pairs

40 Views Asked by At

I want to find the mathematical formula for this pseudo-code

ans = 0

for(i = 1 to x)

{

for(j = 1 to y)

      ans+= gcd(i, j)

}

print ans

Please help me find the formula with a valid proof for it.